/** * Удаление ОПФ * * @param Opf $opf * @return \Illuminate\Http\RedirectResponse * @throws \Exception */ public function delete(Opf $opf) { if (Organization::where('opf_id', $opf->id)->exists()) { dd('Есть организации с таким ОПФ'); } $opf->delete(); return redirect()->route('admin::opf'); }
/** * Страница редактирования организации * @param Organization $organization * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function editPage(Organization $organization) { FormFacade::model($organization); return view('admin.organization.create', ['statuses' => Status::lists('name', 'id'), 'opfs' => Opf::lists('name', 'id'), 'cities' => City::lists('name', 'id'), 'type' => $organization->type_id, 'parent' => $organization->parent, 'organization' => $organization, 'phone' => $organization->phone, 'email' => $organization->email, 'menu' => 'edit']); }
/** * */ protected function createOrganizations() { $this->misc['statuses'] = Status::all()->keyBy('name'); $this->misc['opfs'] = Opf::all()->keyBy('name'); $this->misc['cities'] = City::all()->keyBy('name'); $this->misc['types'] = Type::all()->keyBy('name'); foreach ($this->data as $row) { $this->createOrganization($row); } }