A
A
arseniylebedev2018-12-28 13:45:42
Laravel
arseniylebedev, 2018-12-28 13:45:42

How to add a value to the model before inserting into the base?

I need to generate the event_id string before inserting the model into the database. How to do it in the model?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Wells, 2018-12-28
@Alex_Wells

Use this: https://laravel.com/docs/master/eloquent#observers
As far as I know the above method is already deprecated in at least new versions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question