创建模型 post and user 以及 users , posts ,user_post(favorities)测试数据 在此可以看上一篇中的数据,本次测试数据利用的上一篇的数据.detach and attach method 在很多地方 都可以用到 而且非常方便,不用自己查询数据库后在判断是否存在,再添加数据. attach and detach method 在关联表中添加数据 : Route::get('/', function () { $post = \App\Pos…
eloquent-attach-detach-sync-fires-any-event I have a laravel project, and I need to make some calculations immediately after I save a model and attach some data to it. Is there any event that is triggered in laravel after calling attach (or detach/sy…