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();
|
DB::beginTransaction();
|
||||||
try {
|
try {
|
||||||
$land = new Land();
|
$land = new Land();
|
||||||
|
$land->user_id = Auth::user()->id;
|
||||||
$land->owner = $request->owner;
|
$land->owner = $request->owner;
|
||||||
$land->province_code = $request->province_id;
|
$land->province_code = $request->province_id;
|
||||||
$land->regency_code = $request->regency_id;
|
$land->regency_code = $request->regency_id;
|
||||||
|
@ -185,6 +186,7 @@ public function update(Request $request, $id)
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
try {
|
try {
|
||||||
$land = Land::findOrFail($id);
|
$land = Land::findOrFail($id);
|
||||||
|
$land->user_id = Auth::user()->id;
|
||||||
$land->owner = $request->owner;
|
$land->owner = $request->owner;
|
||||||
$land->province_code = $request->province_id;
|
$land->province_code = $request->province_id;
|
||||||
$land->regency_code = $request->regency_id;
|
$land->regency_code = $request->regency_id;
|
||||||
|
|
|
@ -13,6 +13,7 @@ public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('land', function (Blueprint $table) {
|
Schema::create('land', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
|
$table->unsignedBigInteger('user_id');
|
||||||
$table->string('owner');
|
$table->string('owner');
|
||||||
$table->string('province_code');
|
$table->string('province_code');
|
||||||
$table->string('regency_code');
|
$table->string('regency_code');
|
||||||
|
@ -22,6 +23,10 @@ public function up(): void
|
||||||
$table->string('longitude');
|
$table->string('longitude');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Schema::table('land', function (Blueprint $table) {
|
||||||
|
$table->foreign('user_id')->references('id')->on('users');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue