user card search

This commit is contained in:
Kavalar 2023-05-04 15:14:44 +03:00
parent f9c7328529
commit 5c9411726f

View File

@ -3,6 +3,7 @@
namespace backend\modules\card\models; namespace backend\modules\card\models;
use backend\modules\employee\models\ManagerEmployee; use backend\modules\employee\models\ManagerEmployee;
use common\models\User;
use Yii; use Yii;
use yii\base\Model; use yii\base\Model;
use yii\data\ActiveDataProvider; use yii\data\ActiveDataProvider;
@ -47,15 +48,15 @@ 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 {
$userCard = UserCard::find() $userCard = User::find()
->where(['id_user' => Yii::$app->user->id]) ->where(['id' => Yii::$app->user->id])
->one(); ->one();
$employeeIdList = false; $employeeIdList = false;
if (isset($userCard->manager)) { if (isset($userCard->manager)) {
$employeeIdList = ManagerEmployee::find() $employeeIdList = ManagerEmployee::find()
->where(['manager_id' => $userCard->manager->id]) ->where(['manager_id' => Yii::$app->user->id])
->select('user_card_id') ->select('employee_id')
->column(); ->column();
} }