user card search fix 2

This commit is contained in:
Kavalar 2023-05-04 17:59:57 +03:00
parent 80c11b55ca
commit 7852fa4fc1

View File

@ -2,6 +2,7 @@
namespace backend\modules\card\models; namespace backend\modules\card\models;
use backend\modules\employee\models\Manager;
use backend\modules\employee\models\ManagerEmployee; use backend\modules\employee\models\ManagerEmployee;
use common\models\User; use common\models\User;
use Yii; use Yii;
@ -49,8 +50,12 @@ class UserCardSearch extends UserCard
if (Yii::$app->user->can('show_all_profiles')) { if (Yii::$app->user->can('show_all_profiles')) {
$query = UserCard::find(); $query = UserCard::find();
} else { } else {
$manager = Manager::findOne(Yii::$app->user->id);
if (!$manager){
return new ActiveDataProvider();
}
$employeeIdList = ManagerEmployee::find() $employeeIdList = ManagerEmployee::find()
->where(['manager_id' => Yii::$app->user->id]) ->where(['manager_id' => $manager->id])
->select('employee_id') ->select('employee_id')
->column(); ->column();