fix : complete Activity log in admin side
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ActivityLog extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'log_name',
|
||||
'subject_id',
|
||||
'causer_id',
|
||||
'event',
|
||||
'changes',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'changes' => 'array',
|
||||
'created_at' => 'datetime',
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($log) {
|
||||
$log->created_at = now();
|
||||
});
|
||||
}
|
||||
|
||||
public function causer()
|
||||
{
|
||||
return $this->belongsTo(Admin::class, 'causer_id');
|
||||
}
|
||||
}
|
||||
+8
-6
@@ -36,12 +36,14 @@ class File extends Model
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'extension',
|
||||
'size',
|
||||
'original_name',
|
||||
'path'
|
||||
];
|
||||
'name',
|
||||
'extension',
|
||||
'size',
|
||||
'original_name',
|
||||
'path',
|
||||
'created_by',
|
||||
'updated_by'
|
||||
];
|
||||
|
||||
public function flights()
|
||||
{
|
||||
|
||||
+59
-40
@@ -41,64 +41,73 @@ use Illuminate\Database\Eloquent\Model;
|
||||
*/
|
||||
class Flight extends Model
|
||||
{
|
||||
protected $table = 'flights';
|
||||
protected $table = 'flights';
|
||||
|
||||
protected $casts = [
|
||||
'file_id' => 'int',
|
||||
'airline_id' => 'int',
|
||||
'flight_type' => 'int',
|
||||
'departure_time' => 'datetime',
|
||||
'departure_airport_id' => 'int',
|
||||
'arrival_airport_id' => 'int',
|
||||
'price' => 'float',
|
||||
'capacity' => 'int',
|
||||
protected $casts = [
|
||||
'file_id' => 'int',
|
||||
'airline_id' => 'int',
|
||||
'flight_type' => 'int',
|
||||
'departure_time' => 'datetime',
|
||||
'departure_airport_id' => 'int',
|
||||
'arrival_airport_id' => 'int',
|
||||
'price' => 'float',
|
||||
'capacity' => 'int',
|
||||
'views' => 'int',
|
||||
'status' => FlightStatus::class
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'file_id',
|
||||
'airline_id',
|
||||
'flight_type',
|
||||
'departure_time',
|
||||
'departure_airport_id',
|
||||
'arrival_airport_id',
|
||||
'price',
|
||||
'summary',
|
||||
'capacity',
|
||||
'description',
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'file_id',
|
||||
'airline_id',
|
||||
'flight_type',
|
||||
'departure_time',
|
||||
'departure_airport_id',
|
||||
'arrival_airport_id',
|
||||
'price',
|
||||
'summary',
|
||||
'capacity',
|
||||
'description',
|
||||
'views',
|
||||
'status'
|
||||
];
|
||||
'status',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function airline()
|
||||
{
|
||||
return $this->belongsTo(Airline::class);
|
||||
}
|
||||
protected $hidden = [
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
public function airline()
|
||||
{
|
||||
return $this->belongsTo(Airline::class);
|
||||
}
|
||||
|
||||
public function file()
|
||||
{
|
||||
return $this->belongsTo(File::class);
|
||||
}
|
||||
public function file()
|
||||
{
|
||||
return $this->belongsTo(File::class);
|
||||
}
|
||||
|
||||
public function airport()
|
||||
{
|
||||
return $this->belongsTo(Airport::class, 'departure_airport_id');
|
||||
}
|
||||
public function airport()
|
||||
{
|
||||
return $this->belongsTo(Airport::class, 'departure_airport_id');
|
||||
}
|
||||
|
||||
public function bookings()
|
||||
{
|
||||
return $this->hasMany(Booking::class);
|
||||
}
|
||||
|
||||
public function bookings()
|
||||
{
|
||||
return $this->hasMany(Booking::class);
|
||||
}
|
||||
public function arrivalAirport()
|
||||
{
|
||||
return $this->belongsTo(Airport::class, 'arrival_airport_id');
|
||||
}
|
||||
|
||||
public function departureAirport()
|
||||
{
|
||||
return $this->belongsTo(Airport::class, 'departure_airport_id');
|
||||
}
|
||||
|
||||
public function comments()
|
||||
{
|
||||
return $this->hasMany(Comment::class, 'flight_id');
|
||||
@@ -113,4 +122,14 @@ class Flight extends Model
|
||||
$query->where('flight_type', $request->input('flight_type'));
|
||||
}
|
||||
}
|
||||
|
||||
public function creator()
|
||||
{
|
||||
return $this->belongsTo(Admin::class, 'created_by');
|
||||
}
|
||||
|
||||
public function updater()
|
||||
{
|
||||
return $this->belongsTo(Admin::class, 'updated_by');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ class Tour extends Model
|
||||
'departure_time',
|
||||
'status',
|
||||
'created_at',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function file()
|
||||
@@ -51,4 +53,19 @@ class Tour extends Model
|
||||
{
|
||||
return $this->hasMany(Comment::class, 'tour_id');
|
||||
}
|
||||
|
||||
protected $hidden = [
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function creator()
|
||||
{
|
||||
return $this->belongsTo(Admin::class, 'created_by');
|
||||
}
|
||||
|
||||
public function updater()
|
||||
{
|
||||
return $this->belongsTo(Admin::class, 'updated_by');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user