Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(SecurexRequest $request)
 {
     try {
         $file = Input::file('file1');
         $filename1 = 'securex_' . uniqid() . '.jpg';
         $destinationPath = 'images/securex';
         $itemImage = Image::make($file)->fit(350, 450);
         $itemImage->save($destinationPath . '/' . $filename1);
         $request['photo'] = $destinationPath . '/' . $filename1;
         $attachFile = Input::file('file2');
         $filename2 = 'securex_attach_' . uniqid() . '.jpg';
         $destinationPathAttach = 'images/securex';
         $itemAttachment = Image::make($attachFile)->fit(450, 350);
         $itemAttachment->save($destinationPathAttach . '/' . $filename2);
         $request['attachment'] = $destinationPathAttach . '/' . $filename2;
         $securex = Securex::create($request->all());
     } catch (Exception $e) {
         Flash::error('Unable to Save');
         return $this->redirect(handles('blupl/securex::securex'));
     }
     Flash::success($securex->name . ' Saved Successfully');
     return $this->redirect(handles('blupl/securex::member'));
 }