added permissions to settings
This commit is contained in:
parent
83f7073b18
commit
c31524977a
8 changed files with 121 additions and 83 deletions
|
|
@ -24,4 +24,9 @@ class MovieList extends Model
|
|||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
public function sharedUsers(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(User::class)->withPivot('permission')->withTimestamps();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Permission extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
|
|
@ -2,16 +2,13 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Database\Factories\UserFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Facades\Context;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Fortify\TwoFactorAuthenticatable;
|
||||
|
||||
class User extends Authenticatable
|
||||
|
|
@ -60,6 +57,12 @@ class User extends Authenticatable
|
|||
|
||||
return $this->roles->contains('name', strtolower($role));
|
||||
}
|
||||
|
||||
public function sharedLists(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(MovieList::class)->withPivot("permission")->withTimestamps();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user's initials
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue