Link in grid row from relate field


(Tresrob) #1

Hi
I would like to create a link in a GridView line.
The value I would like to take from a relationship function.
This is my current situation:

inside the model I have the following relation:

public function get Passport Value ()
{
return $ this-> hasOne (Passport :: className (), [‘guest’ => ‘host_id’]);
}

in my grid I call the value:

[ ‘attribute’ => ‘Progressive passport department’, ‘value’ => ‘passportValue.id_pass’, ]

Now how do I change the value to a link?

Many Thanks

Roby


(demonking) #2

You can use a function for value :slight_smile:
Like this:

'value' => function($model){
         return Html::a($text,$url);
}