2024-05-23 14:50:53 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2024-05-23 17:03:12 +03:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
2024-05-29 16:20:22 +03:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
2024-05-23 17:03:12 +03:00
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
2024-05-23 14:50:53 +03:00
|
|
|
|
|
|
|
class Project extends Model
|
|
|
|
{
|
|
|
|
use HasFactory;
|
|
|
|
|
|
|
|
protected $fillable = [
|
|
|
|
'id',
|
|
|
|
'name',
|
|
|
|
'description',
|
|
|
|
'department_id',
|
|
|
|
'created_by_id',
|
|
|
|
];
|
2024-05-23 17:03:12 +03:00
|
|
|
|
|
|
|
public function department(): BelongsTo
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Department::class);
|
|
|
|
}
|
|
|
|
|
2024-05-29 16:20:22 +03:00
|
|
|
public function users(): BelongsToMany
|
2024-05-23 17:03:12 +03:00
|
|
|
{
|
2024-05-29 16:20:22 +03:00
|
|
|
return $this->belongsToMany(User::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function task_statuses(): hasMany
|
|
|
|
{
|
|
|
|
return $this->hasMany(TaskStatus::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function tasks(): hasMany
|
|
|
|
{
|
|
|
|
return $this->hasMany(Task::class);
|
2024-05-23 17:03:12 +03:00
|
|
|
}
|
2024-05-23 14:50:53 +03:00
|
|
|
}
|