Does laravel have a pre-method similar to thinkphp?

1. When I add categories in the controller, there is a field path, that needs to execute the method in the model to give the path value, and then the method save ()
thinkphp in the controller has after_insert and after_update.
laravel doesn"t know what to do with it

Apr.01,2021

Please use events in the Eloquent model.
Common events are as follows

creating
created
updating
updated
saving
saved
deleting
deleted

Please check the laravel version for specific events. Different version event types are different
attach a link:
tutorial
the latest version of laravel


http://laravelacademy.org/pos. take a look at the observer


Observers


https://laravel-china.org/doc.

Eloquent's model triggers several events that can monitor retrieved, creating, created, updating, updated, saving, saved, deleting, deleted, restoring, and restored at the following points in the model's life cycle. Events can easily execute code each time a specific model class is saved or updated in the database.

the retrieved event is triggered when an existing model is retrieved from the database. Creating and created events are triggered when the new model is saved for the first time. If the model already exists in the database and the save method is called, the updating and updated events are triggered. In both cases, the saving / saved event is triggered.

Before you start, define a $dispatchesEvents attribute on the Eloquent model to map each point of the life cycle of the Eloquent model to your event class.


learn about observer mode

https://laravel-china.org/doc.


you can try middleware


I also want to know, even if YII has it, but laravel doesn't know

yet.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ade4-2c23f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ade4-2c23f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?