fix: update admin model
This commit is contained in:
+99
-11
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
@@ -8,12 +9,8 @@ namespace App\Models;
|
||||
|
||||
use App\Enums\AdminStatus;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
//use Illuminate\Foundation\Auth\Admin as Authenticate;
|
||||
//use Illuminate\Foundation\Auth\Admin as Authenticate;
|
||||
|
||||
|
||||
/**
|
||||
* Class Admin
|
||||
@@ -30,8 +27,10 @@ use Illuminate\Database\Eloquent\Model;
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class Admin extends User
|
||||
class Admin extends Authenticatable
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'admins';
|
||||
|
||||
public static $snakeAttributes = false;
|
||||
@@ -42,6 +41,7 @@ class Admin extends User
|
||||
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
@@ -63,19 +63,14 @@ class Admin extends User
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* بررسی دسترسی مدیر به ماژول مدیریت کاربران
|
||||
*
|
||||
* @param string $action view|edit|delete|password
|
||||
*/
|
||||
public function canManageUsers(string $action): bool
|
||||
{
|
||||
// مدیریت کاربران فقط برای مدیر فعال مجاز است
|
||||
return $this->status == 1;
|
||||
}
|
||||
|
||||
|
||||
public function canManageTravelTypes(string $action): bool
|
||||
{
|
||||
return $this->status == 1;
|
||||
@@ -91,3 +86,96 @@ class Admin extends User
|
||||
return $this->status == 1;
|
||||
}
|
||||
}
|
||||
//
|
||||
///**
|
||||
// * Created by Reliese Model.
|
||||
// */
|
||||
//
|
||||
//namespace App\Models;
|
||||
//
|
||||
//use App\Enums\AdminStatus;
|
||||
//use Carbon\Carbon;
|
||||
//use Illuminate\Auth\Middleware\Authenticate;
|
||||
//use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
//use Illuminate\Database\Eloquent\Model;
|
||||
//
|
||||
////use Illuminate\Foundation\Auth\Admin as User;
|
||||
////use Illuminate\Foundation\Auth\Admin as Authenticate;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * Class Admin
|
||||
// *
|
||||
// * @property int $id
|
||||
// * @property string $full_name
|
||||
// * @property string $username
|
||||
// * @property string $email
|
||||
// * @property string $mobile
|
||||
// * @property string $password
|
||||
// * @property int $status
|
||||
// * @property Carbon $created_at
|
||||
// * @property Carbon $updated_at
|
||||
// *
|
||||
// * @package App\Models
|
||||
// */
|
||||
//class Admin extends Authenticate
|
||||
//{
|
||||
// protected $table = 'admins';
|
||||
//
|
||||
// public static $snakeAttributes = false;
|
||||
//
|
||||
// protected $casts = [
|
||||
// 'status' => 'int',
|
||||
// ];
|
||||
//
|
||||
// protected $hidden = [
|
||||
// 'password',
|
||||
// ];
|
||||
//
|
||||
// protected $fillable = [
|
||||
// 'full_name',
|
||||
// 'username',
|
||||
// 'email',
|
||||
// 'mobile',
|
||||
// 'password',
|
||||
// 'status',
|
||||
// ];
|
||||
//
|
||||
// public function permissions()
|
||||
// {
|
||||
// return $this->belongsToMany(
|
||||
// Permission::class,
|
||||
// 'admin_permission',
|
||||
// 'admin_id',
|
||||
// 'permission_id'
|
||||
// );
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * بررسی دسترسی مدیر به ماژول مدیریت کاربران
|
||||
// *
|
||||
// * @param string $action view|edit|delete|password
|
||||
// */
|
||||
// public function canManageUsers(string $action): bool
|
||||
// {
|
||||
// // مدیریت کاربران فقط برای مدیر فعال مجاز است
|
||||
// return $this->status == 1;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public function canManageTravelTypes(string $action): bool
|
||||
// {
|
||||
// return $this->status == 1;
|
||||
// }
|
||||
//
|
||||
// public function canManageFlights(string $action): bool
|
||||
// {
|
||||
// return $this->status == 1;
|
||||
// }
|
||||
//
|
||||
// public function canManageTours(string $action): bool
|
||||
// {
|
||||
// return $this->status == 1;
|
||||
// }
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user