restore composer.json, add mysqli extension

This commit is contained in:
2026-04-15 17:02:52 +05:00
commit 77cf56a348
4317 changed files with 1397107 additions and 0 deletions

62
app/Models/Staff.php Executable file
View File

@@ -0,0 +1,62 @@
<?php
namespace App\Models;
use App\Traits\LogOptionsTrait;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Spatie\Activitylog\Traits\LogsActivity;
class Staff extends Authenticatable
{
use LogsActivity, LogOptionsTrait;
protected $fillable = [
'username',
// 'email',
'password',
'role_id'
];
protected static $logName = 'staffs';
protected static $logOnlyDirty = true;
protected static $submitEmptyLogs = false;
protected static $logAttributes = [
'username',
'password',
'role'
];
public function setPasswordAttribute($password)
{
if ( !empty($password) ) {
$this->attributes['password'] = bcrypt($password);
}
}
public function role()
{
return $this->belongsTo(Role::class, 'role_id', 'id')->withDefault([
'name' => 'Удалено'
]);
}
public function hasPermission(string $type, string $permission) : bool
{
return $this->role->hasPermission($type, $permission);
}
public function isAdmin()
{
return $this->role_id === 1;
}
// public function isModerator()
// {
// return $this->roles()->first()->pivot->role_id === 4;
// }
//
// public function isContentManager()
// {
// return $this->roles()->first()->pivot->role_id === 3;
// }
}