Is it possible to create a custom method on Eloquent Model? If so, how do make one? In Laravel's Documentation, it says that you can mutate the value of the column. Thanks in advance!
class Device extends Model {
protected $table = 'devices';
protected $fillable = ['user_id', 'device_token'];
public function user()
{
return $this->belongsTo('App\User');
}
public customFunction(){
return "hello world";
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire