Answer the question
In order to leave comments, you need to log in
How to add property in laravel while saving at model level?
There is a News model, in the database this table has a user_id field user_id
can be obtained by Auth::id()
When adding new news
, it is necessary that user_id is automatically substituted from Auth::id() News::create(['name'=>'Новость 1'])
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question