Skip to content

Commit

Permalink
Return model classname as is if there are no mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephSilber committed Nov 29, 2015
1 parent 62a25dd commit 4c3631d
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/Database/Models.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Silber\Bouncer\Database;

use App\User;
use InvalidArgumentException;

class Models
{
Expand All @@ -12,11 +11,7 @@ class Models
*
* @var array
*/
protected static $models = [
User::class => User::class,
Role::class => Role::class,
Ability::class => Ability::class,
];
protected static $models = [];

/**
* Set the model to be used for abilities.
Expand Down Expand Up @@ -53,16 +48,14 @@ public static function setUsersModel($model)
*
* @param string $model
* @return string
*
* @throws \InvalidArgumentException
*/
public static function classname($model)
{
if (isset(static::$models[$model])) {
return static::$models[$model];
}

throw new InvalidArgumentException("The '{$model}' classname has no mapping.");
return $model;
}

/**
Expand Down

0 comments on commit 4c3631d

Please sign in to comment.