Add exception handler when extension not available when storing marhun photo

This commit is contained in:
afiq.hamzah
2022-11-29 16:47:13 +08:00
parent fb3af661d1
commit 412c77ae9c
+7 -1
View File
@@ -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;