fleetCatalogue/app/Models/VehicleClass.php

50 lines
1.1 KiB
PHP
Raw Normal View History

<?php
namespace App\Models;
use Database\Factories\VehicleClassFactory;
use Eloquent;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
/**
* App\Models\VehicleClass
*
2024-10-02 14:39:29 +00:00
* @property string $name
* @method static VehicleClassFactory factory($count = null, $state = [])
* @method static Builder|VehicleClass newModelQuery()
* @method static Builder|VehicleClass newQuery()
* @method static Builder|VehicleClass query()
2024-10-02 14:39:29 +00:00
* @method static Builder|VehicleClass whereName($value)
* @mixin Eloquent
*/
class VehicleClass extends Model
{
use HasFactory;
2024-10-02 14:39:29 +00:00
protected $primaryKey = 'name';
protected $table = 'classes';
public $incrementing = false;
public $timestamps = false;
protected $guarded = [];
2024-10-02 14:39:29 +00:00
public function getName(): string
{
2024-10-02 14:39:29 +00:00
return $this->name;
}
2024-10-02 14:39:29 +00:00
public function setName(string $name): VehicleClass
{
2024-10-02 14:39:29 +00:00
$this->name = $name;
return $this;
}
2024-10-02 14:39:29 +00:00
public function getDisplayName(): string
{
2024-10-02 14:39:29 +00:00
return ucwords(str_replace('_', ' ', $this->name));
}
}