public function getDetachField($field_id, $ct_id) { $type = ContentType::find($ct_id); $field = Field::find($field_id); $type->fieldable()->detach($field->id); return back()->withMsg("Поле \"{$field->name}\" от материала \"{$type->name}\" успешно отвязано"); }
/** * Boot the service provider. * @return void */ public function boot() { $this->loadViewsFrom(__DIR__ . '/../resources/views', 'content_types'); $this->mergeConfigFrom(realpath(__DIR__ . '/../config/config.php'), 'module'); $this->publishes([__DIR__ . '/../migrations/' => database_path('migrations')], 'migrations'); pusher('sidebar', 'content_types::sidebar', [], 1); pusher('sidebar', 'content_types::posts_menu', ['types' => ContentType::all()], 98); require __DIR__ . '/routes.php'; }