Sometimes we need to control who can register for the app and who can't. This project shows how to add Administrator approval with pending verification page and Laravel Middleware.
One-time payment
Sign in with GitHub to buy
Sign in first, then complete your $9 checkout.
30-day money-back guarantee
Let's start by creating our Roles table:
Migration
Schema::create('roles', function (Blueprint $table) { $table->id(); $table->string('name'); $table->timestamps();});
Then, we can create our Model with a few Role constants:
app/Models/Role.php
class Role extends Model{ public const ADMIN = 1; public const USER = 2; protected $fillable = [ 'name', ];}
Next, we will cover these: