Initial commit of testapi
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Department extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
];
|
||||
|
||||
/**
|
||||
* The projects that belong to the department.
|
||||
*/
|
||||
public function projects(): BelongsToMany {
|
||||
return $this->belongsToMany(
|
||||
Project::class,
|
||||
'department_project',
|
||||
'department_id',
|
||||
'project_id'
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user