Merge pull request #24 from arieeefajar/fix/master-land
fix(master-land): add field user id
This commit is contained in:
commit
d0a7871112
|
@ -85,6 +85,7 @@ public function store(Request $request)
|
|||
DB::beginTransaction();
|
||||
try {
|
||||
$land = new Land();
|
||||
$land->user_id = Auth::user()->id;
|
||||
$land->owner = $request->owner;
|
||||
$land->province_code = $request->province_id;
|
||||
$land->regency_code = $request->regency_id;
|
||||
|
@ -185,6 +186,7 @@ public function update(Request $request, $id)
|
|||
DB::beginTransaction();
|
||||
try {
|
||||
$land = Land::findOrFail($id);
|
||||
$land->user_id = Auth::user()->id;
|
||||
$land->owner = $request->owner;
|
||||
$land->province_code = $request->province_id;
|
||||
$land->regency_code = $request->regency_id;
|
||||
|
|
|
@ -13,6 +13,7 @@ public function up(): void
|
|||
{
|
||||
Schema::create('land', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->string('owner');
|
||||
$table->string('province_code');
|
||||
$table->string('regency_code');
|
||||
|
@ -22,6 +23,10 @@ public function up(): void
|
|||
$table->string('longitude');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::table('land', function (Blueprint $table) {
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue