'db' => [
'class' => 'yii\db\Connection',
...
'charset' => 'utf8mb4',
...
],
public function actionDelete($id)
{
try {
$this->findModel($id)->delete();
Yii::$app->session->setFlash('success', Yii::t('app', 'controller.Food.deleted'));
} catch (\Exception $e) {
Yii::$app->session->setFlash('error', Yii::t('app', 'controller.Food.cannot_delete'));
}
return $this->redirect(['index']);
}