Пример #1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  Brand $brand
  * @return \Illuminate\Http\Response
  */
 public function edit(Brand $brand)
 {
     // may we edit this brand (is the brand connected to our account)
     if (!$brand->mayEdit($this->auth_user)) {
         return Redirect::route('admin.brands.show', $brand->id)->with('message', 'User is not authorized to edit this brand.');
     }
     // if we are authorized, but the brand is the default brand and we
     // are not part of the system account, we probably want to create a new
     // brand instead
     if ($brand->isDefault() && !$this->auth_user->account->isSystemAccount()) {
         return Redirect::route('admin.brands.create');
     }
     return view('brands.edit')->with('brand', $brand)->with('auth_user', $this->auth_user);
 }