43 lines
898 B
PHP
43 lines
898 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Project extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'id',
|
|
'name',
|
|
'description',
|
|
'department_id',
|
|
'created_by_id',
|
|
];
|
|
|
|
public function department(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Department::class);
|
|
}
|
|
|
|
public function users(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(User::class);
|
|
}
|
|
|
|
public function task_statuses(): hasMany
|
|
{
|
|
return $this->hasMany(TaskStatus::class);
|
|
}
|
|
|
|
public function tasks(): hasMany
|
|
{
|
|
return $this->hasMany(Task::class);
|
|
}
|
|
}
|