public static function getEloquentQuery(): Builder
{
$authUser = Auth::guard('admin')->user();
//$branch = Branch::where('corp_id',$authUser->corp_id)->first();
if ($authUser->is_owner) {
// NOTE : Inner join bug on this line
return static::getModel()::query()
->select('branches.id AS branch_id','branches.title AS branch_title','users.*')
->join('branches', 'branches.id', '=', 'users.branch_id')
->where('corp_id',$authUser->corp_id);
}
return static::getModel()::query()->where('branch_id',3);
}
public static function getEloquentQuery(): Builder
{
$authUser = Auth::guard('admin')->user();
//$branch = Branch::where('corp_id',$authUser->corp_id)->first();
if ($authUser->is_owner) {
// NOTE : Inner join bug on this line
return static::getModel()::query()
->select('branches.id AS branch_id','branches.title AS branch_title','users.*')
->join('branches', 'branches.id', '=', 'users.branch_id')
->where('corp_id',$authUser->corp_id);
}
return static::getModel()::query()->where('branch_id',3);
}