Когда я звоню
Код: Выделить всё
auth()->user()and the result is null.
is it possible to call
Код: Выделить всё
auth()->user()and this is my code
Код: Выделить всё
/**
* The "booting" method of the model.
*
* @return void
*/
protected static function boot() {
parent::boot();
static::creating(function ($model) {
$model->created_by = auth()->user()->id;
});
static::updating(function ($model) {
$model->updated_by = auth()->user()->id;
});
}
Источник: https://stackoverflow.com/questions/672 ... de-a-model
Мобильная версия