git add .

git commit "feat: implement activity logging for tours and flights"
This commit is contained in:
2026-08-19 14:59:26 +03:30
parent 7cf68cc02f
commit 4d8839e802
9 changed files with 326 additions and 3 deletions
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Http\Requests\Admin\FlightStoreRequest;
use App\Models\ActivityLog;
use App\Models\Flight;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
@@ -48,8 +49,15 @@ class FlightController extends Controller
$data['created_by'] = auth('admin')->id();
Flight::create($data);
$flight = Flight::create($data);
ActivityLog::create([
'admin_id' => auth('admin')->id(),
'action' => 'create',
'model' => 'Flight',
'model_id' => $flight->id,
'description' => 'ثبت پرواز جدید',
]);
DB::commit();
@@ -107,6 +115,13 @@ class FlightController extends Controller
$flight->update($data);
ActivityLog::create([
'admin_id' => auth('admin')->id(),
'action' => 'update',
'model' => 'Flight',
'model_id' => $flight->id,
'description' => 'ویرایش اطلاعات پرواز',
]);
DB::commit();
@@ -136,6 +151,13 @@ class FlightController extends Controller
}
ActivityLog::create([
'admin_id' => auth('admin')->id(),
'action' => 'delete',
'model' => 'Flight',
'model_id' => $flight->id,
'description' => 'حذف پرواز',
]);
$flight->delete();