forge/app/Models/License.php

58 lines
1.3 KiB
PHP
Raw Normal View History

2024-05-15 00:31:24 -04:00
<?php
2025-01-30 00:23:55 -05:00
declare(strict_types=1);
2024-05-15 00:31:24 -04:00
namespace App\Models;
2025-01-30 15:44:05 -05:00
use Carbon\Carbon;
2025-01-30 20:49:56 -05:00
use Database\Factories\LicenseFactory;
2025-01-30 15:44:05 -05:00
use Illuminate\Database\Eloquent\Collection;
2024-05-15 00:31:24 -04:00
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
2025-01-30 15:44:05 -05:00
/**
* License Model
*
* @property int $id
* @property int|null $hub_id
* @property string $name
* @property string $link
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property-read Collection<int, Mod> $mods
*/
2024-05-15 00:31:24 -04:00
class License extends Model
{
2025-01-30 20:49:56 -05:00
/** @use HasFactory<LicenseFactory> */
2024-09-12 13:19:52 -04:00
use HasFactory;
2025-01-30 20:49:56 -05:00
2024-09-12 13:19:52 -04:00
use SoftDeletes;
2024-05-15 00:31:24 -04:00
2024-07-20 19:52:36 -04:00
/**
* The relationship between a license and mod.
2024-09-12 13:19:52 -04:00
*
2025-01-30 15:44:05 -05:00
* @return HasMany<Mod, $this>
2024-07-20 19:52:36 -04:00
*/
2024-05-15 00:31:24 -04:00
public function mods(): HasMany
{
return $this->hasMany(Mod::class)
->chaperone();
2024-05-15 00:31:24 -04:00
}
2024-10-12 13:18:04 -06:00
/**
* The attributes that should be cast to native types.
*/
protected function casts(): array
{
return [
'hub_id' => 'integer',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
];
}
2024-05-15 00:31:24 -04:00
}