modules/api/v2/controllers/TailorController.php
/**
     * Displays a single Tailor model.
     * @param integer $id
     * @return mixed
     * @throws NotFoundHttpException if the model cannot be found
     */
Displays a single Tailor model.
@param integer $id
@return mixed
@throws NotFoundHttpException if the model cannot be found
Displays a single Tailor model . @param integer $id @return mixed @throws NotFoundHttpException if the model cannot be found
public function actionView($id)
    {
        $model = Tailor::findOne($id);
        if (!$model instanceof Tailor) {
            throw new NotFoundHttpException('Tailor doesn\'t exist.');
        }
        $tailor_shop_image = Yii::$app->request->getHostInfo() . Yii::getAlias('@uploadsAbsolutePath') . '/no-image.jpg';
        if (!empty($model->shop_image) && file_exists(Yii::getAlias('@tailorShopImageRelativePath') . '/' . $model->shop_image)) {
            $tailor_shop_image = Yii::$app->request->getHostInfo() . Yii::getAlias('@tailorShopImageAbsolutePath') . '/' . $model->shop_image;
        }
        $model->shop_image = $tailor_shop_image;
        $tailor_voucher_image = Yii::$app->request->getHostInfo() . Yii::getAlias('@uploadsAbsolutePath') . '/no-image.jpg';
        if (!empty($model->voucher) && file_exists(Yii::getAlias('@tailorVoucherImageRelativePath') . '/' . $model->voucher)) {
            $tailor_voucher_image = Yii::$app->request->getHostInfo() . Yii::getAlias('@tailorVoucherImageAbsolutePath') . '/' . $model->voucher;
        }
        $model->zip_code = (string)$model->zip_code;
        $model->voucher = $tailor_voucher_image;
        return $model;
    }
public function actionView ( $ id ) { $ model = Tailor :: findOne ( $ id ) ; if ( ! $ model instanceof Tailor ) { throw new NotFoundHttpException ( 'Tailor doesn\'t exist.' ) ; } $ tailor_shop_image = Yii :: $ app -> request -> getHostInfo ( ) . Yii :: getAlias ( '@uploadsAbsolutePath' ) . '/no-image.jpg' ; if ( ! empty ( $ model -> shop_image ) && file_exists ( Yii :: getAlias ( '@tailorShopImageRelativePath' ) . '/' . $ model -> shop_image ) ) { $ tailor_shop_image = Yii :: $ app -> request -> getHostInfo ( ) . Yii :: getAlias ( '@tailorShopImageAbsolutePath' ) . '/' . $ model -> shop_image ; } $ model -> shop_image = $ tailor_shop_image ; $ tailor_voucher_image = Yii :: $ app -> request -> getHostInfo ( ) . Yii :: getAlias ( '@uploadsAbsolutePath' ) . '/no-image.jpg' ; if ( ! empty ( $ model -> voucher ) && file_exists ( Yii :: getAlias ( '@tailorVoucherImageRelativePath' ) . '/' . $ model -> voucher ) ) { $ tailor_voucher_image = Yii :: $ app -> request -> getHostInfo ( ) . Yii :: getAlias ( '@tailorVoucherImageAbsolutePath' ) . '/' . $ model -> voucher ; } $ model -> zip_code = ( string ) $ model -> zip_code ; $ model -> voucher = $ tailor_voucher_image ; return $ model ; }
Displays a single Tailor model.
Displays a single Tailor model .