add photo marhun
This commit is contained in:
@@ -412,8 +412,19 @@ class MarhunController extends Controller
|
||||
|
||||
public function show($id, $lelong_id)
|
||||
{
|
||||
$lelongbid = LelongBid::where('id','=',$id)->first();
|
||||
$marhun = LelongBidMarhun::where('lelongbid_id','=',$id)->get();
|
||||
$lelongbid = LelongBid::where('id', '=', $id)->first();
|
||||
$filemarhun = FileMarhun::where('lelongbid_id', '=', $lelongbid['id'])
|
||||
->where('photo_type', '=', '1')->first();
|
||||
if (isset($filemarhun)) {
|
||||
$lelongbid->filemarhun = $filemarhun->filename;
|
||||
}
|
||||
$marhun = LelongBidMarhun::where('lelongbid_id', '=', $id)->get();
|
||||
foreach ($marhun as $index) {
|
||||
$eachmarhun = FileMarhun::where('lelongbidmarhun_id', '=', $index['id'])->first();
|
||||
if (isset($eachmarhun)) {
|
||||
$index->eachmarhun = $eachmarhun->filename;
|
||||
}
|
||||
}
|
||||
$lelkarat = LelKarat::where('lelong_id','=',$lelongbid->lelong_id)->get();
|
||||
$karatall = JenisKarat::all();
|
||||
$emasall = JenisEmas::all();
|
||||
@@ -1120,20 +1131,29 @@ class MarhunController extends Controller
|
||||
return view('marhun.scanbarcode');
|
||||
}
|
||||
|
||||
public function savePhotoOverallMarhun(Request $request) {
|
||||
// dump($request->gambarMarhun);
|
||||
public function addPhotoMarhun(Request $request) {
|
||||
$data = base64_encode($request->gambarMarhun->get());
|
||||
$file_type = $request->gambarMarhun->extension();
|
||||
|
||||
$addfile = new FileMarhun();
|
||||
$addfile->file_type = $file_type;
|
||||
$addfile->filename = $data;
|
||||
$addfile->save();
|
||||
// dd($addfile);
|
||||
}
|
||||
|
||||
public function savePhotoEachMarhun() {
|
||||
|
||||
if ($request->photo_type == 1) {
|
||||
$addfile = new FileMarhun();
|
||||
$addfile->lelongbid_id = $request->lelongbid_id;
|
||||
$addfile->photo_type = 1;
|
||||
$addfile->file_type = $file_type;
|
||||
$addfile->filename = $data;
|
||||
$addfile->save();
|
||||
}
|
||||
else if ($request->photo_type == 2) {
|
||||
$addfile = new FileMarhun();
|
||||
$addfile->lelongbid_id = $request->lelongbid_id;
|
||||
$addfile->lelongbidmarhun_id = $request->lelongbidmarhun_id;
|
||||
$addfile->photo_type = 2;
|
||||
$addfile->file_type = $file_type;
|
||||
$addfile->filename = $data;
|
||||
$addfile->save();
|
||||
}
|
||||
return redirect()->route('marhun.show', [$request->lelongbid_id, $request->lelong_id])
|
||||
->with('success','Gambar Berjaya Di Simpan.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user