Merge pull request #14 from witelgroup/feature/Rahdarkhane
add area to history
This commit is contained in:
@@ -166,6 +166,7 @@ class RoadMaintenanceStationController extends Controller
|
|||||||
'previous_lat' => $rahdariPoint->lat,
|
'previous_lat' => $rahdariPoint->lat,
|
||||||
'previous_lng' => $rahdariPoint->lng,
|
'previous_lng' => $rahdariPoint->lng,
|
||||||
'new_files' => json_encode($rahdariPoint->files),
|
'new_files' => json_encode($rahdariPoint->files),
|
||||||
|
'area' => json_encode($rahdariPoint->area),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$rahdariPoint->update([
|
$rahdariPoint->update([
|
||||||
@@ -196,6 +197,7 @@ class RoadMaintenanceStationController extends Controller
|
|||||||
'lng_to' => $request->lng_to,
|
'lng_to' => $request->lng_to,
|
||||||
'color' => $request->color,
|
'color' => $request->color,
|
||||||
'updated_at_fa' => verta()->now()->format('Y/m/d H:i:s'),
|
'updated_at_fa' => verta()->now()->format('Y/m/d H:i:s'),
|
||||||
|
'area' => json_encode($request->area),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$uploadFields = [
|
$uploadFields = [
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ class UpdateRequest extends FormRequest
|
|||||||
'overview_files_3' => 'file|mimes:jpg,jpeg,png,pdf|max:5120',
|
'overview_files_3' => 'file|mimes:jpg,jpeg,png,pdf|max:5120',
|
||||||
'overview_files_4' => 'file|mimes:jpg,jpeg,png,pdf|max:5120',
|
'overview_files_4' => 'file|mimes:jpg,jpeg,png,pdf|max:5120',
|
||||||
'overview_files_5' => 'file|mimes:jpg,jpeg,png,pdf|max:5120',
|
'overview_files_5' => 'file|mimes:jpg,jpeg,png,pdf|max:5120',
|
||||||
|
'area' => 'required|array',
|
||||||
|
'area.type' => 'required|string',
|
||||||
|
'area.coordinates' => 'required|array',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ class RahdariPoint extends Model
|
|||||||
'lat_to',
|
'lat_to',
|
||||||
'lng_to',
|
'lng_to',
|
||||||
'updated_at_fa',
|
'updated_at_fa',
|
||||||
|
'area'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function files(): MorphMany
|
public function files(): MorphMany
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class RahdariPointHistory extends Model
|
class RahdariPointHistory extends Model
|
||||||
@@ -33,11 +34,19 @@ class RahdariPointHistory extends Model
|
|||||||
'previous_lat',
|
'previous_lat',
|
||||||
'previous_lng',
|
'previous_lng',
|
||||||
'new_files',
|
'new_files',
|
||||||
'point_id'
|
'point_id',
|
||||||
|
'area'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function rahdariPoint()
|
public function rahdariPoint()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\RahdariPoint');
|
return $this->belongsTo('App\Models\RahdariPoint');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function area(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn($value) => json_decode($value)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('rahdari_point_histories', function (Blueprint $table) {
|
||||||
|
$table->json('area')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('rahdari_point_histories', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('area');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user