Calling custom function from custom GridView column.

Hi,

I have the following custom column in my GridView:




[

   'attribute' => 'id',

   'label' => 'Invoices',

   'value' =>  function($model)

               {

                  $invoicelinks = $Invoice->getInvoiceLinks($model->id); //Invoice is my model,

                  return $invoicelinks;

               },

],



What I am trying to do is to build normal href links in a function and return it to the GridView to display it in a column. Firstly I need to know what is best practice regarding the function creation? Do I create it in my model, controller or component? I thought my model would be best, but now not so sure. And then how do I reference it via the column?

Thanks

Okay,

I created a function in my Invoices model class and used code below in the GridView column, if it’s wrong, please let me know:




[

   'attribute' => 'id',

   'label' => 'Invoices/Quotes',

   'value' =>  function($model)

               {

                  $invoicemodel = new Invoices();

                  $invoicelinks = $invoicemodel->getInvoiceLinks($model->id);

                  return $invoicelinks;

               },

   'format' => 'raw',

],



Thank You