/**
  * Creates a new Link model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Link();
     if ($model->load(\App::$app->request->post())) {
         $model->bannar = UploadedFile::getInstance($model, 'bannar');
         if ($model->bannar) {
             $contractName = mt_rand(1100, 9900) . time() . '.' . $model->bannar->extension;
             $model->bannar->saveAs('upload/' . $contractName);
             $model->bannar = $contractName;
         }
         $model->cat_id = \App::$app->request->post()['Link']['cat_id'];
         $model->intro = \App::$app->request->post()['Link']['intro'];
         $model->status = \App::$app->request->post()['Link']['status'];
         $model->link = \App::$app->request->post()['Link']['link'];
         $model->save();
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }