add migration filemarhun

This commit is contained in:
Amir
2022-09-04 09:50:30 +08:00
parent 27f20fe54e
commit 996665a3ee
5 changed files with 85 additions and 13 deletions
+16
View File
@@ -14,6 +14,7 @@ use App\Models\JenisKarat;
use App\Models\Gadai;
use App\Models\Lelong;
use App\Models\CawanganLelong;
use App\Models\FileMarhun;
use App\Models\LelongBid;
use App\Models\LelongBidMarhun;
use App\Models\LelKarat;
@@ -1119,5 +1120,20 @@ class MarhunController extends Controller
return view('marhun.scanbarcode');
}
public function savePhotoOverallMarhun(Request $request) {
// dump($request->gambarMarhun);
$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() {
}
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class FileMarhun extends Model
{
use HasFactory;
protected $table = 'filemarhun';
protected $fillable = [
'lelongbid_id',
'lelongbidmarhun_id',
'file_type',
'filename',
];
}
@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFilemarhunTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('filemarhun', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('lelongbid_id')->unsigned()->nullable();
$table->unsignedBigInteger('lelongbidmarhun_id')->unsigned()->nullable();
$table->string('file_type');
$table->timestamps();
});
// once the table is created use a raw query to ALTER it and add the MEDIUMBLOB
DB::statement("ALTER TABLE filemarhun ADD filename LONGBLOB");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('filemarhun');
}
}
+10 -9
View File
@@ -254,24 +254,25 @@
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body justify-content-center">
<form id="form1">
<form id="form1" action="{{route('marhun.savephotooverallmarhun')}}" method="POST" enctype="multipart/form-data">
@csrf
<div class="modal-body justify-content-center">
<div class="row justify-content-center">
<img id="blah" style="max-width: 400px; max-height: 400px;" src="#" alt="gambar marhun" />
</div>
<div class="row justify-content-center">
<input type='file' accept="image/*;capture=camera" id="imgInp" /><br>
<input type='file' accept="image/*;capture=camera" name="gambarMarhun" id="inputGroupFile04" /><br>
</div>
<div class="row mt-5 justify-content-center">
<button type='file' accept="image/*;capture=camera" class="btn m-2 btn-warning">tukar gambar</button>
<button class="btn m-2 btn-danger">padam gambar</button>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" style="width:15%;" data-dismiss="modal">Tutup</button>
<button type="button" class="btn btn-primary" style="width:15%;" data-dismiss="modal">Simpan</button>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" style="width:15%;" data-dismiss="modal">Tutup</button>
<button type="submit" class="btn btn-primary" style="width:15%;">Simpan</button>
</div>
</form>
</div>
</div>
+2 -4
View File
@@ -240,6 +240,8 @@ Route::group(['middleware' => ['permission:semakanmarhun','permission:kemaskinim
Route::post('/tambahmarhun',['as'=>'marhun.tambahmarhun','uses'=>'MarhunController@tambahmarhun']);
Route::get('/exportmarhundetails/{lelong_id}',['as'=>'marhun.exportmarhundetails','uses'=>'MarhunController@exportmarhundetails']);
//Penilai
Route::post('/savephotooverallmarhun',['as'=>'marhun.savephotooverallmarhun','uses'=>'MarhunController@savePhotoOverallMarhun']);
});
//Khazanah
@@ -442,10 +444,6 @@ Route::get('laporanlelfullcaw/{lelong_id}',['as'=>'reportcaw.laporanlelfullcaw',
Route::get('indexbrglelpembidacaw',['as'=>'reportcaw.indexbrglelpembidacaw','uses'=>'ReportCawanganController@indexbrglelpembidacaw']);
Route::get('laporanbrglelpembidacaw/{lelong_id}',['as'=>'reportcaw.laporanbrglelpembidacaw','uses'=>'ReportCawanganController@laporanbrglelpembidacaw']);
});