Дипломная работа: Автоматизация учета рабочего времени сотрудников в ТОО "Автоцентр АСТЭК"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
121
[
'actions' => ['index', 'view', 'create',
'update', 'delete'],
'allow' => true,
'roles' => ['@'],
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
/**
* Lists all Vacation models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new VacationSearch();
$dataProvider = $searchModel->search(Yii::$app->request-
>queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
122
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Vacation model.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Vacation model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Vacation();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('create', [
'model' => $model,
123
]);
}
/**
* Updates an existing Vacation model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('update', [
'model' => $model,
]);
}
/**
* Deletes an existing Vacation model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionDelete($id)
{
124
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Vacation model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Vacation the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Vacation::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException(Yii::t('app', 'The requested page does
not exist.'));
}
}
Источник: https://baza.diplomsite.ru/previewfile/2419