mercredi 3 juillet 2019

Using accessor for column name in model gives error of "Undefined App\ModelName::$column_name"

I have used an accessor to get the modified value for a column, and I haven't used $appends for that because the accesor name is according to column name. It gives me error of

  undefined property App\ModelName::$colimn_name 

In controller

ModelOther::select('column_name')where(condition)->get();

In ModelName model

public function getColumnNameAttribute()
{
    return "Hello ".$this->column_name;
}



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2KZPPLF
via IFTTT

Aucun commentaire:

Enregistrer un commentaire