Esempio n. 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(SocietiesRequest $request)
 {
     $society = Society::create($request->except('logo'));
     if ($request->file('logo')) {
         $fileName = "societylogo_" . $society->id . "." . $request->file('logo')->getClientOriginalExtension();
         $request->file('logo')->move(base_path() . '/storage/app/images/', $fileName);
         $society->logo = '/storage/app/images/' . $fileName;
         $img = Image::make(base_path() . $society->logo);
         $img->resize(160, 160);
         $img->save(base_path() . '/storage/app/images/' . $fileName);
     }
     $society->save();
     return Redirect::route('societies.edit', $society->id)->with('okmessage', 'New society has been added');
 }