In my laravel & vue.js app I need to have three types of users. Admin, Institution, User. I have created base table users and user_institution, user_personal using polymorphism. I have added Admin user with DatabaseSeeder and the admin should create institution users, and personal users need to register. I have roles table
public function up()
> {
> Schema::create('roles', function (Blueprint $table) {
> $table->smallInteger('id')->primary()->unsigned();
>
> $table->string('name')->unique();
> $table->string('display_name')->nullable();
> $table->string('description')->nullable();
>
> $table->timestamps();
> });
> }
>
Users Table
> public function up()
> {
> Schema::create('users', function (Blueprint $table) {
> $table->bigIncrements('id');
> $table->string('email')->unique();
> $table->string('password');
>
> $table->string('avatar')->nullable();
>
> $table->morphs('userable');
> $table->boolean('confirmed')->default(0);
> $table->string('confirmation_code')->nullable();
> $table->dateTime('confirmation_expiry')->nullable();
>
> $table->smallInteger('role_id')->unsigned();
> $table->foreign('role_id')->references('id')->on('roles');
>
> $table->rememberToken();
> $table->timestamps();
> });
> }
Models> RoleModel, UserModel, InstitutionModel, PersonalModel
How to create my api method for registering personal users and institution users. What i need for that?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire