Пример #1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function editCompanyExhibitor($id)
 {
     //
     $countries = Country::all();
     $exhibitor = Exhibitor::find($id);
     //authorization
     if (!$this->adminAuth() && !$this->companyAuth($exhibitor->company->user->id)) {
         return view('errors.404');
     }
     return view('exhibitors.editcompanyexhibitor', compact('exhibitor', 'countries'));
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     //
     $v = Validator::make(Request::all(), ['name' => 'required|max:50']);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors())->withInput();
     } else {
         $exhibitorId = Request::get('id');
         $exhibitor = Exhibitor::find($exhibitorId);
         $exhibitor->country_id = Request::get('country');
         $exhibitor->city = Request::get('city');
         $exhibitor->address = Request::get('address');
         $exhibitor->desc = Request::get('desc');
         $exhibitor->phone = Request::get('phone');
         $exhibitor->anotherphone = Request::get('anotherphone');
         $exhibitor->fax = Request::get('fax');
         $exhibitor->save();
         return redirect('exhibitors/' . $exhibitorId);
     }
 }