[Illuminate\Contracts\Filesystem\FileNotFoundException]
images/foobar/NatGeo05.jpg
[League\Flysystem\FileNotFoundException]
File not found at path: images/foobar/NatGeo05.jpg
I'm doing:
// assume $photo works
try {
// fails here
Storage::get($photo->name);
}
catch (Exception $e) {
$photo->delete(); // doesn't come here
}
public function render($request, Exception $e)
{
if($e instance of \Illuminate\Contracts\Filesystem\FileNotFoundException)
{
// Do something
}
return parent::render($request, $e);
}
use Illuminate\Contracts\Filesystem\FileNotFoundException; //at the top of your script
try {
$file = Storage::get($photo->name);
} catch (FileNotFoundException $e) {
abort(404); //or whatever you want do here
}