⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

How to call a function from custom model?



Qarlo

Qarlo
  • profile picture
  • Member

Posted 10 November 2017 - 13:44 PM

Hello,

I was trying to set up a custom model.

 

I followed the example from the set_model documentation page:

https://www.grocerycrud.com/documentation/options_functions/set_model

 

In the example a function called "get_relation_n_n_unselected_array" is defined. What I find strange is that this function never gets called.

 

So in my code I tried the following:

public function edit_photo()
{
$this->view = false;

$crud = new grocery_CRUD();

$crud->set_model('My_Custom_model');
$crud->set_theme('datatables');
$crud->my_function();
...
class My_Custom_model extends grocery_CRUD_Model {

    function my_function()
    {
        echo 'test';
    }
}

I made sure that the custom model is inside the models directory.

 

I get an error that my_function is undefined.

 

What am I doing wrong?

 


caramayson

caramayson
  • profile picture
  • Member

Posted 17 August 2018 - 10:11 AM

When you characterize the parameters, you have the alternative of simply writing in the parameter name or giving them a default esteem. You'll see the greater part of the parameters are compared to some esteem. These are their default esteems.


mp3man

mp3man
  • profile picture
  • Member

Posted 17 July 2019 - 16:50 PM

Just replace your call...

$crud->my_function();

by this one:

$crud->basic_model->my_function();

rominause

rominause
  • profile picture
  • Member

Posted 12 October 2020 - 11:36 AM

I guess I saw similar topic here at trader's community, I hope you will find the answer below https://www.forextime.com/trading-accounts/cent-account


VirginiaTone

VirginiaTone
  • profile picture
  • Member

Posted 11 November 2020 - 21:13 PM

Thank for sharing!


jameskrs

jameskrs
  • profile picture
  • Member

Posted 24 December 2020 - 12:51 PM

Find the best Political Science Assignment Help Experts

 

 

Political Science is one of the most well-known subject decisions for students who need to go in government related or regulatory jobs. Political Science Assignment Help is the study of Politics and its ideas that happen in the general public. The subject has been for quite some time concentrated by numerous well-known scholars and researchers in the whole world. Indeed, numerous incredible books and speculations have been distributed in such manner. It essentially manages political conduct and the working of government and administration.

 

Visit Our Website : https://www.greatassignmenthelp.com/political-science-assignment-help/