julianov's avatar

Delete generic user model, migration and controller

Hello All.

I don't want to use the generic user model, migration table and controller which cames when a new laravel proyects start. So I delete it (the migration table, the controller and the model) but I get this output:

include(/home/julian/Documentos/Programacion/LARAVEL/portal/vendor/composer/../../app/Http/Controllers/Controller.php): Failed to open stream: No such file or directory".

In vender files, where I should delete that line? I cant' find it.

0 likes
10 replies
vincent15000's avatar

Why don't you want to use the generic Laravel files ?

Is there any reason ?

Why are you using Laravel if you don't want to use the files ?

Sinnbeck's avatar

Most likely you have one or more controllers that is still extending the default controller. Remove this extends. It isn't needed

2 likes
psrz's avatar

You can use a different migrations table. You have to change that in config/database.php which has an entry to customize it.

You don't have to use the Controller class. No need to delete it.

Regarding the user model, why would you do that ?

You can edit that model and add whatever behavior you need but deleting it ? Unless you're planning on making an application that uses no authorization nor authentication whatsoever, you're going to need the user model.

You can make your own but I can't imagine the benefit of it.

2 likes
julianov's avatar

@psrz because there are different types of users, and therefore different tables in the DB and different controllers. So we call models and controllers differently. So, you say that it is not necessary to delete that generic model and controller? no matter how empty they are?

1 like
jlrdw's avatar

@julianov

Because I want to use Eloquent and passport

That has nothing to do with user login to use the system.

Example: A humane society uses the adopt a pet API. But only certain roles can connect with adopt a pet, therefore regular authorization is used to allow access to the MVC portion where you actually login to adopt a pet to add or edit animals.

2 likes
Sinnbeck's avatar

@julianov I would suggest that you stick with 1 users table and use roles instead. What happens when a user suddenly have 2 accounts on the same email? Will they understand that the password is different? And which should be used with which login portal

2 likes
julianov's avatar

@Sinnbeck Thanks but Can I rename the User model to Citizen? Use only that model called citizen and use different roles in this

1 like
vincent15000's avatar

@julianov Yes you can rename the User model to Citizen if you really need. But I wouldn't do that, because the User model is used at many places in the framework core and even if you manage to rename and let your code work, there's not real guarantee that it will work when you will code a new functionality where Laravel will need to retrieve a user.

1 like

Please or to participate in this conversation.