File::isFile PHP Method

isFile() public static method

Determine if the given path is a file.
public static isFile ( string $file ) : boolean
$file string
return boolean
        public static function isFile($file)
        {
            return \Illuminate\Filesystem\Filesystem::isFile($file);
        }

Usage Example

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, ['opening' => 'required', 'dimensions' => 'required', 'address' => 'required', 'capacity' => 'required']);
     $santiago = Santiago::find($id);
     if ($request->file('edit-santiago-photo')) {
         $this->validate($request, ['edit-santiago-photo' => 'required|image|mimes:jpeg,jpg,png,bmp,gif,svg']);
         $santiagoFile = $santiago->photo_path . $santiago->photo_name;
         if (\File::isFile($santiagoFile)) {
             \File::delete($santiagoFile);
         }
         $file = $request->file('edit-santiago-photo');
         $santiago_photo_path = $this->_santiago_photo_path;
         $santiago_photo_name = $file->getClientOriginalName();
         $file->move($santiago_photo_path, $santiago_photo_name);
         $santiago->photo_name = $santiago_photo_name;
         $santiago->photo_path = $santiago_photo_path;
     }
     $santiago->opening = $request->get('opening');
     $santiago->dimensions = $request->get('dimensions');
     $santiago->address = $request->get('address');
     $santiago->capacity = $request->get('capacity');
     $santiago->save();
     flash()->success('', 'Santiago redaguotas!');
     return Redirect::to('/dashboard/santiago/');
 }
All Usage Examples Of File::isFile