芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/portpulselogistics.com/Modules/Cargo/Entities/Staff.php
hasOne('Modules\Cargo\Entities\Branch', 'id', 'branch_id'); } public function user(){ return $this->hasOne('App\Models\User', 'id', 'user_id'); } public function getStaff($query) { if(auth()->user()->role == 3){ $branch = Branch::where('user_id',auth()->user()->id)->pluck('id')->first(); $query = $query->where('is_archived', 0)->where('branch_id', $branch); }elseif(auth()->user()->can('manage-staffs') && auth()->user()->role == 0){ $branch = Staff::where('user_id',auth()->user()->id)->pluck('branch_id')->first(); $query = $query->where('is_archived', 0)->where('branch_id', $branch); } return $query; } }