[WIP] Fix ergonomics rules
This commit is contained in:
45
app/Models/Core/Auth/PermissionUser.php
Normal file
45
app/Models/Core/Auth/PermissionUser.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Core\Auth;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PermissionUser extends Model
|
||||
{
|
||||
protected $table = 'permission_user';
|
||||
|
||||
public function permission()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Core\Auth\Permission');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Core\Auth\User');
|
||||
}
|
||||
|
||||
public function team()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Core\Auth\Team');
|
||||
}
|
||||
|
||||
public function scopeByUser($query, $id)
|
||||
{
|
||||
return $query->where('user_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByPermission($query, $id)
|
||||
{
|
||||
return $query->where('permission_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByUserType($query, $name)
|
||||
{
|
||||
return $query->where('user_type', $name);
|
||||
}
|
||||
|
||||
public function scopeByTeam($query, $id)
|
||||
{
|
||||
return $query->where('team_id', $id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user