<?phpnamespace App\Observers;use App\Models\Permission;class PermissionObserver
{//观察者public function creating(Permission $permission){$permission->is_menu = request()->get('is_menu','0');$permission->routename = request()->get('routename');}}
<?phpnamespace App\Models;use App\Observers\PermissionObserver;/*** App\Models\Permission** @property int $id* @property string $name 权限名* @property string $routename 权限名* @property \Illuminate\Support\Carbon|null $created_at* @property \Illuminate\Support\Carbon|null $updated_at* @property string|null $deleted_at* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Permission newModelQuery()* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Permission newQuery()* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Permission query()* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Permission whereCreatedAt($value)* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Permission whereDeletedAt($value)* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Permission whereId($value)* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Permission whereName($value)* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Permission whereRoutename($value)* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Permission whereUpdatedAt($value)* @mixin \Eloquent*/
class Permission extends Base
{protected static function boot(){# diaoyong GuanChaQistatic::observe(PermissionObserver::class);parent::boot(); // TODO: Change the autogenerated stub}}