Merge branch 'afiqhamzah-feat-add-capture-marhun-picture' into 'main'

Add exception handler when extension not available when storing marhun photo

See merge request online-sistem1/lelong!309
This commit is contained in:
Muhamad Amir Hassan Hamzan
2022-11-29 08:51:18 +00:00
+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;