@@ -26,8 +26,8 @@ discard block  | 
                                                    ||
| 26 | 26 | |
| 27 | 27 | /**  | 
                                                        
| 28 | 28 | * Create a new Guest Pass.  | 
                                                        
| 29 | - * @param lluminate\Database\Eloquent\Model $owner  | 
                                                        |
| 30 | - * @param lluminate\Database\Eloquent\Model $object  | 
                                                        |
| 29 | + * @param Model $owner  | 
                                                        |
| 30 | + * @param Model $object  | 
                                                        |
| 31 | 31 | * @param string|null $view Leave out the .blade.php extension.  | 
                                                        
| 32 | 32 | * @return bool|Exception  | 
                                                        
| 33 | 33 | */  | 
                                                        
@@ -51,8 +51,8 @@ discard block  | 
                                                    ||
| 51 | 51 | |
| 52 | 52 | /**  | 
                                                        
| 53 | 53 | * Check if the given user created the Guest Pass.  | 
                                                        
| 54 | - * @param lluminate\Database\Eloquent\Model $owner  | 
                                                        |
| 55 | - * @param lluminate\Database\Eloquent\Model $guestpass  | 
                                                        |
| 54 | + * @param Model $owner  | 
                                                        |
| 55 | + * @param Model $guestpass  | 
                                                        |
| 56 | 56 | * @return bool  | 
                                                        
| 57 | 57 | */  | 
                                                        
| 58 | 58 | public function isOwner(Model $owner, Model $guestpass)  | 
                                                        
@@ -70,8 +70,8 @@ discard block  | 
                                                    ||
| 70 | 70 | |
| 71 | 71 | /**  | 
                                                        
| 72 | 72 | * Find (or fail) the Guest Pass belonging to an owner-object pairing.  | 
                                                        
| 73 | - * @param lluminate\Database\Eloquent\Model $owner  | 
                                                        |
| 74 | - * @param lluminate\Database\Eloquent\Model $object  | 
                                                        |
| 73 | + * @param Model $owner  | 
                                                        |
| 74 | + * @param Model $object  | 
                                                        |
| 75 | 75 | * @return lluminate\Database\Eloquent\Collection|Exception  | 
                                                        
| 76 | 76 | */  | 
                                                        
| 77 | 77 | public function findGuestPass(Model $owner, Model $object)  | 
                                                        
@@ -9,8 +9,7 @@ discard block  | 
                                                    ||
| 9 | 9 | /**  | 
                                                        
| 10 | 10 | * Create a new instance.  | 
                                                        
| 11 | 11 | */  | 
                                                        
| 12 | - public function __construct()  | 
                                                        |
| 13 | -    { | 
                                                        |
| 12 | +    public function __construct() { | 
                                                        |
| 14 | 13 | // constructor body  | 
                                                        
| 15 | 14 | }  | 
                                                        
| 16 | 15 | |
@@ -18,8 +17,7 @@ discard block  | 
                                                    ||
| 18 | 17 | * Register the routes.  | 
                                                        
| 19 | 18 | * @return void  | 
                                                        
| 20 | 19 | */  | 
                                                        
| 21 | - public function routes()  | 
                                                        |
| 22 | -    { | 
                                                        |
| 20 | +    public function routes() { | 
                                                        |
| 23 | 21 |          $router = app('router'); | 
                                                        
| 24 | 22 |          $router->get('gp/{owner}/{key}', 'JeroenG\GuestPass\Controllers\Access'); | 
                                                        
| 25 | 23 | }  | 
                                                        
@@ -31,8 +29,7 @@ discard block  | 
                                                    ||
| 31 | 29 | * @param string|null $view Leave out the .blade.php extension.  | 
                                                        
| 32 | 30 | * @return bool|Exception  | 
                                                        
| 33 | 31 | */  | 
                                                        
| 34 | - public function create(Model $owner, Model $object, $view = null)  | 
                                                        |
| 35 | -    { | 
                                                        |
| 32 | +    public function create(Model $owner, Model $object, $view = null) { | 
                                                        |
| 36 | 33 |          try { | 
                                                        
| 37 | 34 | GuestPass::create([  | 
                                                        
| 38 | 35 | 'key' => str_random(10),  | 
                                                        
@@ -55,13 +52,11 @@ discard block  | 
                                                    ||
| 55 | 52 | * @param lluminate\Database\Eloquent\Model $guestpass  | 
                                                        
| 56 | 53 | * @return bool  | 
                                                        
| 57 | 54 | */  | 
                                                        
| 58 | - public function isOwner(Model $owner, Model $guestpass)  | 
                                                        |
| 59 | -    { | 
                                                        |
| 55 | +    public function isOwner(Model $owner, Model $guestpass) { | 
                                                        |
| 60 | 56 | return $owner->id == $guestpass->owner_id;  | 
                                                        
| 61 | 57 | }  | 
                                                        
| 62 | 58 | |
| 63 | - public function getKeysOf(Model $owner)  | 
                                                        |
| 64 | -    { | 
                                                        |
| 59 | +    public function getKeysOf(Model $owner) { | 
                                                        |
| 65 | 60 | return GuestPass::where([  | 
                                                        
| 66 | 61 | 'owner_id' => $owner->id,  | 
                                                        
| 67 | 62 | 'owner_model' => get_class($owner),  | 
                                                        
@@ -74,8 +69,7 @@ discard block  | 
                                                    ||
| 74 | 69 | * @param lluminate\Database\Eloquent\Model $object  | 
                                                        
| 75 | 70 | * @return lluminate\Database\Eloquent\Collection|Exception  | 
                                                        
| 76 | 71 | */  | 
                                                        
| 77 | - public function findGuestPass(Model $owner, Model $object)  | 
                                                        |
| 78 | -    { | 
                                                        |
| 72 | +    public function findGuestPass(Model $owner, Model $object) { | 
                                                        |
| 79 | 73 | return GuestPass::where([  | 
                                                        
| 80 | 74 | 'owner_id' => $owner->id,  | 
                                                        
| 81 | 75 | 'owner_model' => get_class($owner),  | 
                                                        
@@ -89,8 +83,7 @@ discard block  | 
                                                    ||
| 89 | 83 | * @param string $key  | 
                                                        
| 90 | 84 | * @return lluminate\Database\Eloquent\Model|Exception  | 
                                                        
| 91 | 85 | */  | 
                                                        
| 92 | - public function getGuestPass($key)  | 
                                                        |
| 93 | -    { | 
                                                        |
| 86 | +    public function getGuestPass($key) { | 
                                                        |
| 94 | 87 |          return GuestPass::where('key', $key)->firstOrFail(); | 
                                                        
| 95 | 88 | }  | 
                                                        
| 96 | 89 | }  | 
                                                        
@@ -35,7 +35,7 @@  | 
                                                    ||
| 35 | 35 | /**  | 
                                                        
| 36 | 36 | * Get the services provided by the provider.  | 
                                                        
| 37 | 37 | *  | 
                                                        
| 38 | - * @return array  | 
                                                        |
| 38 | + * @return string[]  | 
                                                        |
| 39 | 39 | */  | 
                                                        
| 40 | 40 | public function provides()  | 
                                                        
| 41 | 41 |      { | 
                                                        
@@ -27,7 +27,7 @@  | 
                                                    ||
| 27 | 27 | */  | 
                                                        
| 28 | 28 | public function register()  | 
                                                        
| 29 | 29 |      { | 
                                                        
| 30 | -        $this->app->singleton('guestpass', function ($app) { | 
                                                        |
| 30 | +        $this->app->singleton('guestpass', function($app) { | 
                                                        |
| 31 | 31 | return new GuestPassService;  | 
                                                        
| 32 | 32 | });  | 
                                                        
| 33 | 33 | }  | 
                                                        
@@ -11,8 +11,7 @@ discard block  | 
                                                    ||
| 11 | 11 | *  | 
                                                        
| 12 | 12 | * @return void  | 
                                                        
| 13 | 13 | */  | 
                                                        
| 14 | - public function boot()  | 
                                                        |
| 15 | -    { | 
                                                        |
| 14 | +    public function boot() { | 
                                                        |
| 16 | 15 | // Make the migrations available.  | 
                                                        
| 17 | 16 | $this->loadMigrationsFrom(__DIR__.'/../database/migrations');  | 
                                                        
| 18 | 17 | |
@@ -25,8 +24,7 @@ discard block  | 
                                                    ||
| 25 | 24 | *  | 
                                                        
| 26 | 25 | * @return void  | 
                                                        
| 27 | 26 | */  | 
                                                        
| 28 | - public function register()  | 
                                                        |
| 29 | -    { | 
                                                        |
| 27 | +    public function register() { | 
                                                        |
| 30 | 28 |          $this->app->singleton('guestpass', function ($app) { | 
                                                        
| 31 | 29 | return new GuestPassService;  | 
                                                        
| 32 | 30 | });  | 
                                                        
@@ -37,8 +35,7 @@ discard block  | 
                                                    ||
| 37 | 35 | *  | 
                                                        
| 38 | 36 | * @return array  | 
                                                        
| 39 | 37 | */  | 
                                                        
| 40 | - public function provides()  | 
                                                        |
| 41 | -    { | 
                                                        |
| 38 | +    public function provides() { | 
                                                        |
| 42 | 39 | return ['guestpass'];  | 
                                                        
| 43 | 40 | }  | 
                                                        
| 44 | 41 | }  | 
                                                        
@@ -13,7 +13,7 @@  | 
                                                    ||
| 13 | 13 | */  | 
                                                        
| 14 | 14 | public function up()  | 
                                                        
| 15 | 15 |      { | 
                                                        
| 16 | -        Schema::create('guestpasses', function (Blueprint $table) { | 
                                                        |
| 16 | +        Schema::create('guestpasses', function(Blueprint $table) { | 
                                                        |
| 17 | 17 |              $table->increments('id'); | 
                                                        
| 18 | 18 |              $table->string('key', 10)->unique(); | 
                                                        
| 19 | 19 |              $table->string('owner_model'); | 
                                                        
@@ -11,8 +11,7 @@ discard block  | 
                                                    ||
| 11 | 11 | *  | 
                                                        
| 12 | 12 | * @return void  | 
                                                        
| 13 | 13 | */  | 
                                                        
| 14 | - public function up()  | 
                                                        |
| 15 | -    { | 
                                                        |
| 14 | +    public function up() { | 
                                                        |
| 16 | 15 |          Schema::create('guestpasses', function (Blueprint $table) { | 
                                                        
| 17 | 16 |              $table->increments('id'); | 
                                                        
| 18 | 17 |              $table->string('key', 10)->unique(); | 
                                                        
@@ -30,8 +29,7 @@ discard block  | 
                                                    ||
| 30 | 29 | *  | 
                                                        
| 31 | 30 | * @return void  | 
                                                        
| 32 | 31 | */  | 
                                                        
| 33 | - public function down()  | 
                                                        |
| 34 | -    { | 
                                                        |
| 32 | +    public function down() { | 
                                                        |
| 35 | 33 |          Schema::dropIfExists('guestpasses'); | 
                                                        
| 36 | 34 | }  | 
                                                        
| 37 | 35 | }  | 
                                                        
@@ -11,8 +11,7 @@  | 
                                                    ||
| 11 | 11 | *  | 
                                                        
| 12 | 12 | * @return string  | 
                                                        
| 13 | 13 | */  | 
                                                        
| 14 | - protected static function getFacadeAccessor()  | 
                                                        |
| 15 | -    { | 
                                                        |
| 14 | +    protected static function getFacadeAccessor() { | 
                                                        |
| 16 | 15 | return 'guestpass';  | 
                                                        
| 17 | 16 | }  | 
                                                        
| 18 | 17 | }  | 
                                                        
@@ -12,8 +12,7 @@  | 
                                                    ||
| 12 | 12 |  { | 
                                                        
| 13 | 13 | use AuthorizesRequests, DispatchesJobs, ValidatesRequests;  | 
                                                        
| 14 | 14 | |
| 15 | - public function __invoke($owner, $key)  | 
                                                        |
| 16 | -    { | 
                                                        |
| 15 | +    public function __invoke($owner, $key) { | 
                                                        |
| 17 | 16 | // First, get the Guest Pass and corresponding object models.  | 
                                                        
| 18 | 17 | $pass = GuestPass::getGuestPass($key);  | 
                                                        
| 19 | 18 | $object = (new $pass->object_model)->findOrFail($pass->object_id);  |