git add .
git commit "feat: implement activity logging for tours and flights"
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\TourStoreRequest;
|
||||
use App\Models\ActivityLog;
|
||||
use App\Models\Tour;
|
||||
use App\Models\TravelType;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -50,7 +51,15 @@ class TourController extends Controller
|
||||
|
||||
$data['created_by'] = auth('admin')->id();
|
||||
|
||||
Tour::create($data);
|
||||
$tour = Tour::create($data);
|
||||
|
||||
ActivityLog::create([
|
||||
'admin_id' => auth('admin')->id(),
|
||||
'action' => 'create',
|
||||
'model' => 'Tour',
|
||||
'model_id' => $tour->id,
|
||||
'description' => 'ثبت تور جدید',
|
||||
]);
|
||||
|
||||
|
||||
DB::commit();
|
||||
@@ -109,6 +118,14 @@ class TourController extends Controller
|
||||
|
||||
$tour->update($data);
|
||||
|
||||
ActivityLog::create([
|
||||
'admin_id' => auth('admin')->id(),
|
||||
'action' => 'create',
|
||||
'model' => 'Tour',
|
||||
'model_id' => $tour->id,
|
||||
'description' => 'ویرایش تور',
|
||||
]);
|
||||
|
||||
|
||||
DB::commit();
|
||||
|
||||
@@ -138,6 +155,14 @@ class TourController extends Controller
|
||||
|
||||
}
|
||||
|
||||
ActivityLog::create([
|
||||
'admin_id' => auth('admin')->id(),
|
||||
'action' => 'create',
|
||||
'model' => 'Tour',
|
||||
'model_id' => $tour->id,
|
||||
'description' => 'حذف تور',
|
||||
]);
|
||||
|
||||
|
||||
$tour->delete();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user