Skip to content

Commit

Permalink
Bugfix: wrong case for $beantype
Browse files Browse the repository at this point in the history
  • Loading branch information
Lútsen Stellingwerff committed Jun 4, 2017
1 parent 0bbf5ba commit 44c90ac
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions routes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@
*
* @var string $beantype The type of bean.
*
* @return string The name of the controller.
* @return object The controller.
*/
function setupBeanModel($beantype) {
$beantype = ucfirst( strtolower( $beantype ) );
if ( !file_exists( ROOT_PATH. '/models/lagan/'.$beantype.'.php' ) ) {
throw new \Exception('The '.$beantype.' model does not exist.');
}

// Return model
$model_name = '\Lagan\Model\\' . ucfirst($beantype);
$model_name = '\Lagan\Model\\' . $beantype;
return new $model_name();
}

Expand Down

0 comments on commit 44c90ac

Please sign in to comment.