Advertisement
nazmiwafiy

findModel

Dec 6th, 2018
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1.     /**
  2.      * Finds the Contact model based on its primary key value.
  3.      * If the model is not found, a 404 HTTP exception will be thrown.
  4.      * @param integer $id
  5.      * @return Contact the loaded model
  6.      * @throws NotFoundHttpException if the model cannot be found
  7.      */
  8.     protected function findModel($id)
  9.     {
  10.         if (($model = Contact::findOne($id)) !== null) {
  11.             return $model;
  12.         } else {
  13.             throw new NotFoundHttpException('The requested page does not exist.');
  14.         }
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement