简体   繁体   中英

Call to undefined method App\Libraries\GroceryCrud::set_relation()

Im usng codeigniter4 with grocery crud for codeigniter4

But im getting the above error when i setup the relation

    $crud = new GroceryCrud();
    $crud->setTable('departments'); 
    $crud->columns(['depname','dep_head','bld','flr','ext','email','comp_id']);
    $crud->set_relation('comp_id','company_login','cname');  
    $crud->displayAs('depname','Department')->displayAs('dep_head','Department Head') -> displayAs('bld','Building')->displayAs('flr','Floor')->displayAs('ext','Extension') ->displayAs('email','Department email') ->displayAs('comp_id','Company');
    $output = $crud->render();
    return $this->_exampleOutput($output);

Error is appearing in

$crud->set_relation('comp_id','company_login','cname'); 

表结构

Please help

Solved

$crud->set_relation('comp_id','company_login','cname'); 

it is:

$crud->setRelation('comp_id','company_login','cname'); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM