Exemplo n.º 1
0
 public static function deleteManager($id)
 {
     $manager = Manager::findOne($id);
     if ($manager->delete()) {
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 2
0
 public static function getCurrShop()
 {
     $manager = Manager::findOne(['user_id' => Yii::$app->user->id]);
     if ($manager) {
         $shop = Shop::findOne(['id' => $manager->shop_id]);
         if ($shop) {
             return $shop->title;
         }
     }
 }
Exemplo n.º 3
0
 public static function getUserID($id)
 {
     $manager = Manager::findOne($id);
     if ($manager) {
         $user = User::findOne($manager->user_id);
         if ($user) {
             return $user->id;
         }
     } else {
         return false;
     }
 }
Exemplo n.º 4
0
 public static function showShopID()
 {
     $manager = Manager::findOne(['user_id' => Yii::$app->user->id]);
     if ($manager) {
         return $manager->shop_id;
     }
 }
 /**
  * Finds the Manager model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Manager the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Manager::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }