public function actionCreate()
 {
     if (Yii::$app->user->can('createResource')) {
         $firmwareId = Yii::$app->request->get('firmware_id');
         if ($firmwareId) {
             $firmware = Firmware::findOne(['id' => $firmwareId]);
             $job = new Job();
             $job->firmware_id = $firmware->id;
             $job->insert();
             $job->setCurrentStatus(JobStatus::INIT);
             return $this->render('edit', ['model' => $job]);
         }
     } else {
         Yii::$app->getSession()->setFlash('error', 'Not allowed.');
     }
     return $this->redirect(['index']);
 }
 public function actionDelete()
 {
     if (Yii::$app->user->can('deleteResource')) {
         $id = Yii::$app->request->get('id');
         if ($id) {
             $model = Firmware::findOne(['id' => $id]);
             if ($model->delete()) {
                 Yii::$app->getSession()->setFlash('success', 'Firmware deleted.');
             } else {
                 Yii::$app->getSession()->setFlash('error', 'Failed to delete firmware.');
             }
         }
     } else {
         Yii::$app->getSession()->setFlash('error', 'Not allowed.');
     }
     return $this->redirect(['index']);
 }