diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 9be752a1..4eb37d58 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -5,8 +5,9 @@ use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Routing\Controller as BaseController; use Illuminate\Foundation\Validation\ValidatesRequests; +use Illuminate\Foundation\Auth\Access\AuthorizesRequests; abstract class Controller extends BaseController { - use DispatchesJobs, ValidatesRequests; + use AuthorizesRequests, DispatchesJobs, ValidatesRequests; } diff --git a/app/Jobs/Job.php b/app/Jobs/Job.php index d99ae7e8..55ece29a 100644 --- a/app/Jobs/Job.php +++ b/app/Jobs/Job.php @@ -13,7 +13,7 @@ abstract class Job | | This job base class provides a central location to place any logic that | is shared across all of your jobs. The trait included with the class - | provides access to the "queueOn" and "delay" queue helper methods. + | provides access to the "onQueue" and "delay" queue helper methods. | */ diff --git a/app/Policies/.gitkeep b/app/Policies/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php new file mode 100644 index 00000000..9b358300 --- /dev/null +++ b/app/Providers/AuthServiceProvider.php @@ -0,0 +1,31 @@ + 'App\Policies\ModelPolicy', + ]; + + /** + * Register any application authentication / authorization services. + * + * @param \Illuminate\Contracts\Auth\Access\Gate $gate + * @return void + */ + public function boot(GateContract $gate) + { + parent::registerPolicies($gate); + + // + } +} diff --git a/app/User.php b/app/User.php index 86eabed1..9f1e7481 100644 --- a/app/User.php +++ b/app/User.php @@ -5,12 +5,16 @@ use Illuminate\Auth\Authenticatable; use Illuminate\Database\Eloquent\Model; use Illuminate\Auth\Passwords\CanResetPassword; +use Illuminate\Foundation\Auth\Access\Authorizable; use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; +use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; -class User extends Model implements AuthenticatableContract, CanResetPasswordContract +class User extends Model implements AuthenticatableContract, + AuthorizableContract, + CanResetPasswordContract { - use Authenticatable, CanResetPassword; + use Authenticatable, Authorizable, CanResetPassword; /** * The database table used by the model. diff --git a/config/app.php b/config/app.php index 15c75aa5..656f4bb0 100644 --- a/config/app.php +++ b/config/app.php @@ -141,6 +141,7 @@ * Application Service Providers... */ App\Providers\AppServiceProvider::class, + App\Providers\AuthServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, @@ -172,6 +173,7 @@ 'Eloquent' => Illuminate\Database\Eloquent\Model::class, 'Event' => Illuminate\Support\Facades\Event::class, 'File' => Illuminate\Support\Facades\File::class, + 'Gate' => Illuminate\Support\Facades\Gate::class, 'Hash' => Illuminate\Support\Facades\Hash::class, 'Input' => Illuminate\Support\Facades\Input::class, 'Inspiring' => Illuminate\Foundation\Inspiring::class, diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index a48ac724..c7a1ecf0 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -41,6 +41,7 @@ 'in' => 'The selected :attribute is invalid.', 'integer' => 'The :attribute must be an integer.', 'ip' => 'The :attribute must be a valid IP address.', + 'json' => 'The :attribute must be a valid JSON string.', 'max' => [ 'numeric' => 'The :attribute may not be greater than :max.', 'file' => 'The :attribute may not be greater than :max kilobytes.', diff --git a/resources/views/errors/503.blade.php b/resources/views/errors/503.blade.php index 0380666a..4a415059 100644 --- a/resources/views/errors/503.blade.php +++ b/resources/views/errors/503.blade.php @@ -3,7 +3,7 @@ Be right back. - +