Taks 4 - belongsToMany pivot

This commit is contained in:
PovilasKorop
2021-11-22 07:47:31 +02:00
parent 0fbdf0c99a
commit 4ec2014369
8 changed files with 128 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Role extends Model
{
use HasFactory;
protected $fillable = ['name'];
public function users()
{
// TASK: fix this by adding a parameter
return $this->belongsToMany(User::class);
}
}