public function update(Request $request, $id)
 {
     $callout = $this->homePage->find($id);
     $callout->update($request->all());
     if ($request->hasFile('callout_1')) {
         // check if previous photo exists and delete it.
         $callout->deletePhoto($callout->callout_1);
         // generate a random file name
         $filename = Str::random(10) . time();
         // assinged file input to a variable
         $image = $request['callout_1'];
         $extension = $image->getClientOriginalExtension();
         // open image file
         $photo = Image::make($image->getRealPath());
         $photo->resize(627, null, function ($constraint) {
             $constraint->aspectRatio();
         });
         $photo->crop(627, 320);
         // final file name
         $filename = $filename . '.' . $extension;
         // save file with medium quality
         $photo->save(public_path() . '/uploads/homepage_callouts/' . $filename, 100);
         // get original image file extension
         // store file name in database
         $callout->callout_1 = $filename;
     }
     if ($request->hasFile('callout_2')) {
         // check if previous photo exists and delete it.
         $callout->deletePhoto($callout->callout_2);
         // generate a random file name
         $filename = Str::random(10) . time();
         // assinged file input to a variable
         $image = $request['callout_2'];
         $extension = $image->getClientOriginalExtension();
         // open image file
         $photo = Image::make($image->getRealPath());
         $photo->resize(627, null, function ($constraint) {
             $constraint->aspectRatio();
         });
         $photo->crop(627, 320);
         // final file name
         $filename = $filename . '.' . $extension;
         // save file with medium quality
         $photo->save(public_path() . '/uploads/homepage_callouts/' . $filename, 100);
         // get original image file extension
         // store file name in database
         $callout->callout_2 = $filename;
     }
     $callout->save();
     return back()->with('success', 'Homepage Callouts Updated!');
 }
 public function index()
 {
     $callout = $this->homePage->find(1);
     $slides = $this->slide->where('archive', 0)->where('draft', 0)->orderby('order', 'asc')->get();
     return view('pages.home', compact('slides', 'callout'));
 }