Add pengurusan gambar marhun components
This commit is contained in:
@@ -14,6 +14,7 @@ use App\Models\Payment;
|
||||
use App\Models\Cart;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Cawangan;
|
||||
use App\Models\CawanganLelong;
|
||||
use App\Models\FileMarhun;
|
||||
use App\Models\Resit;
|
||||
use App\Models\FileResit;
|
||||
@@ -1429,5 +1430,47 @@ class LelongMobileController extends Controller
|
||||
}
|
||||
return response()->json(['success' => true]);
|
||||
}
|
||||
|
||||
public function listLelong()
|
||||
{
|
||||
$lelong_all = Lelong::select('id')->get();
|
||||
return response()->json($lelong_all);
|
||||
}
|
||||
|
||||
public function listCawangan(Request $request)
|
||||
{
|
||||
$cawangan_all = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
||||
->where('lelong_id', $request->lelong_id)
|
||||
->select('cawangan_lelong.caw_id', 'cawangan.caw_name')->get();
|
||||
return response()->json($cawangan_all);
|
||||
}
|
||||
|
||||
public function listLelongBid(Request $request)
|
||||
{
|
||||
$lelong_bid_all = LelongBid::with('fileMarhunMain')
|
||||
->where('caw_id', $request->caw_id)
|
||||
->where('lelong_id', $request->lelong_id)
|
||||
->select(['id','norujukan', 'marhun', 'nilaimarhun'])
|
||||
->get();
|
||||
|
||||
return response()->json($lelong_bid_all);
|
||||
}
|
||||
|
||||
public function showPhotoMarhun(Request $request)
|
||||
{
|
||||
$fileMarhun = FileMarhun::find($request->filemarhun_id, ['file_type']);
|
||||
|
||||
$directory = "/{$request->norujukan}/overall_photo/";
|
||||
$imageExtension = $fileMarhun->file_type;
|
||||
|
||||
$marhunImageFileName = "overall.{$imageExtension}";
|
||||
|
||||
if (Storage::disk('marhun')->exists("{$directory}${marhunImageFileName}")) {
|
||||
$marhun_photo = Storage::disk('marhun')->get("{$directory}${marhunImageFileName}");
|
||||
return base64_encode($marhun_photo);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user