/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  * POST!
  * Save image to file storage and URL to database
  */
 public function store(Request $request)
 {
     // SAVE PIC
     $decoded_image = base64_decode($request->image);
     $image_name = "pic" . "_" . uniqid();
     //$laravel_path = public_path() . '/images/' . $image_name . ".png";
     // binero production:
     $image_path = '/catdetector/images/' . $image_name . ".png";
     $image_path = getcwd() . '/images/' . $image_name . ".png";
     file_put_contents($image_path, $decoded_image);
     $image_url = url('/') . "/images/" . $image_name . ".png";
     echo $image_url;
     $pic = new Pic();
     $pic->url = $image_url;
     $pic->save();
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(PicRequest $request)
 {
     $pic = new Pic(['path' => $request->path]);
     $pic->save();
     return redirect('/admin/pic');
 }