| @@ 95-102 (lines=8) @@ | ||
| 92 | * @return Media the loaded model |
|
| 93 | * @throws NotFoundHttpException if the model cannot be found |
|
| 94 | */ |
|
| 95 | protected function findModelBySlug($slug) |
|
| 96 | { |
|
| 97 | if (($model = Media::findOne(['slug' => $slug])) !== null) { |
|
| 98 | return $model; |
|
| 99 | } |
|
| 100 | ||
| 101 | throw new NotFoundHttpException(Yii::t('writesdown', 'The requested page does not exist.')); |
|
| 102 | } |
|
| 103 | } |
|
| 104 | ||
| @@ 80-87 (lines=8) @@ | ||
| 77 | * @return User the loaded model |
|
| 78 | * @throws NotFoundHttpException if the model cannot be found |
|
| 79 | */ |
|
| 80 | protected function findModel($id) |
|
| 81 | { |
|
| 82 | if (($model = User::findOne($id)) !== null) { |
|
| 83 | return $model; |
|
| 84 | } |
|
| 85 | ||
| 86 | throw new NotFoundHttpException(Yii::t('writesdown', 'The requested page does not exist.')); |
|
| 87 | } |
|
| 88 | ||
| 89 | /** |
|
| 90 | * Finds the User model based on its primary key value. |
|
| @@ 97-104 (lines=8) @@ | ||
| 94 | * @return User the loaded model |
|
| 95 | * @throws NotFoundHttpException if the model cannot be found |
|
| 96 | */ |
|
| 97 | protected function findModelByUsername($username) |
|
| 98 | { |
|
| 99 | if (($model = User::findOne(['username' => $username])) !== null) { |
|
| 100 | return $model; |
|
| 101 | } |
|
| 102 | ||
| 103 | throw new NotFoundHttpException(Yii::t('writesdown', 'The requested page does not exist.')); |
|
| 104 | } |
|
| 105 | } |
|
| 106 | ||