Commit 255e6a80 authored by Shakarim Sapa's avatar Shakarim Sapa

- Добавлен метод удаления курса из базы

parent 28e79a33
......@@ -14,7 +14,8 @@ class CourseAdminController extends AdminController {
return [
'Manage' => 'Управление курсами',
'Create' => 'Добавление нового курса',
'Update' => 'Редактирование курса'
'Update' => 'Редактирование курса',
'Delete' => 'Удаление курса'
];
}
......@@ -60,7 +61,7 @@ class CourseAdminController extends AdminController {
*/
public function actionUpdate($id){
/** @var AnalyticsSchoolCourse $model */
$model = self::findModel($id);
$model = $this->findModel($id);
if ($model->load(\Yii::$app->request->post())) {
if ($model->validate() && $model->save())
return $this->redirect([
......@@ -89,4 +90,14 @@ class CourseAdminController extends AdminController {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
/**
* @param $id
* @return \yii\web\Response
*/
public function actionDelete($id){
$this->findModel($id)->delete();
return $this->redirect(['manage']);
}
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment