Add exception handler when extension not available when storing marhun photo
This commit is contained in:
@@ -6,6 +6,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Models\FileMarhun;
|
||||
use App\Models\LelongBid;
|
||||
use Exception;
|
||||
|
||||
class MarhunPhotoService
|
||||
{
|
||||
@@ -14,7 +15,12 @@ class MarhunPhotoService
|
||||
{
|
||||
|
||||
|
||||
$file_type = $request->gambarMarhun->extension();
|
||||
try{
|
||||
$file_type = $request->gambarMarhun->getClientOriginalExtension();
|
||||
} catch(Exception $exception){
|
||||
$file_type = 'PNG';
|
||||
logger($exception);
|
||||
}
|
||||
|
||||
$addfile = new FileMarhun();
|
||||
$addfile->lelongbid_id = $request->lelongbid_id;
|
||||
|
||||
Reference in New Issue
Block a user