Updated logo API
This commit is contained in:
@@ -2,19 +2,46 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class UserAction extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'user_flight_id',
|
||||
'message',
|
||||
'type',
|
||||
'data'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'user_flight_id' => 'integer',
|
||||
'user_id' => 'integer',
|
||||
'message' => 'string',
|
||||
'data' => 'array',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'display_type',
|
||||
];
|
||||
|
||||
protected function displayType(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn () => match ($this->type) {
|
||||
'flight_booked' => 'Flight Booked',
|
||||
'flight_cancelled' => 'Flight Cancelled',
|
||||
'flight_updated' => 'Flight Updated',
|
||||
'flight_imported' => 'Flight Imported',
|
||||
'flight_logged' => 'Flight Logged',
|
||||
'flight_deleted' => 'Flight Deleted',
|
||||
default => 'Unknown Action'
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user