user card search fix 2

This commit is contained in:
Kavalar 2023-05-04 18:02:08 +03:00
parent 7852fa4fc1
commit 48463110bd

View File

@ -43,16 +43,16 @@ class UserCardSearch extends UserCard
* *
* @param array $params * @param array $params
* *
* @return ActiveDataProvider * @return ActiveDataProvider | bool
*/ */
public function search($params): ActiveDataProvider public function search($params)
{ {
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); $manager = Manager::findOne(Yii::$app->user->id);
if (!$manager){ if (!$manager){
return new ActiveDataProvider(); return false;
} }
$employeeIdList = ManagerEmployee::find() $employeeIdList = ManagerEmployee::find()
->where(['manager_id' => $manager->id]) ->where(['manager_id' => $manager->id])