Added basic models and factories

This commit is contained in:
Constantin Graf
2024-01-21 18:35:29 +01:00
parent 28f7b43577
commit 6377df1f44
29 changed files with 1476 additions and 116 deletions

52
app/Models/Task.php Normal file
View File

@@ -0,0 +1,52 @@
<?php
declare(strict_types=1);
namespace App\Models;
use Database\Factories\TaskFactory;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @property string $id
* @property string $name
* @property string $project_id
* @property string $organization_id
* @property-read Project $project
* @property-read Team $organization
*
* @method static TaskFactory factory()
*/
class Task extends Model
{
use HasFactory;
use HasUuids;
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'name' => 'string',
];
/**
* @return BelongsTo<Project, Task>
*/
public function project(): BelongsTo
{
return $this->belongsTo(Project::class);
}
/**
* @return BelongsTo<Team, Task>
*/
public function organization(): BelongsTo
{
return $this->belongsTo(Team::class, 'organization_id');
}
}