HomeController disappeared after running php artisan make:auth - laravel

I was working on a PHP application and at some point needed to include a login. I did that by running php artisan make:auth to generate the authentication files. Later on I realized that my HomeController was not the same again. It only contained one function as opposed to my own HomeController which had multiple functions.
Is it possible to retrieve my HomeController?

Related

Laravel 5.2 session lost after successful login, sometimes

When trying to access a protected route or just refreshing the page the session is lost, so I have to login again. What I don't understand is that sometimes this problem does not happen but most of the time it does and sometimes it takes more than 3 times of doing the login before I can finally access a protected route. This only happens in production. I have no idea but it started only after I moved my hosting to Cloudways and users start complaining.I have other Laravel app with version 5.4 on the same server without problems.
1- change your session driver value to database then the user's session will be stored inside your database, sessions table instead of file:
in your .env file set :
SESSION_DRIVER=Database
2- clean cache and config
php artisan config:clear
php artisan cache:clear

There isn't displays authentication block in Laravel project

I'm completely new in Laravel. I don't understand why authentication block doesn't displays after I installed laravel/ui and php artisan make:auth command. These pages have been added. But there aren't any special routes in routes list. code
In web.php you have to use
Auth::routes();

Difference between a 'Controller' and a 'Resource Controller' in Laravel

In Laravel, what's the difference between a regular controller and resource controller? Please provide examples to illustrate the differences.
There is mainly no difference..It a special type of controller.
When you create a controller like this
php artisan make:controller YourNameController --resource
it auto create some function like index, create, store, show, edit, update, destroy. basically for crud.
For details go to documentation https://laravel.com/docs/7.x/controllers#resource-controllers
Well, the only difference is this.
The resource controller creates a PHP file with already defined CRUD operations while a regular controller creates an empty file.
To create a regular controller with the name UserController
php artisan make:controller UserController
To create a resource controller
php artisan make:controller UserController --resource
Hope it was helpful
Use this for more resources https://laravel.com/docs/9.x/controllers

How to make my Laravel API project with Passport faster?

I'm developing a Laravel API based on larapi project and I think I'm doing something wrong, because every request to my API takes about 3 seconds to return, don't matter the size of the response.
I've searched a lot and already tried to run the following commands, but my requests still slow:
composer dump-autoload -o
php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artisan view:clear
My server and database server are hosted separatedly. I already did some tests with other projects and the servers runs fast. It seems to be a problem with Passport (Laravel OAuth authentication), it try to authenticate the user's access token on every request.
Has anyone faced this problem?
Thanks for your attenion.
Regards.

Laravel 5: how to create controller with method name

I am new to Laravel 5 and gone through https://laravel.com/docs/5.8/controllers but could not find any way in which i could create controller using php artisan with a specific method name. I tried below options but none of them work.
php artisan make:controller HomeControler#index logout
and
php artisan make:controller HomeControler/index logout
and
php artisan make:controller HomeController index logout
Is it possible in Laravel 5 to achieve this? If yes, is it also possible to declare more than one function while creating controller using artisan make command?
php artisan make:controller HomeControler --resource
The controller will contain a method for each of the available resource operations:
index
create
store
show
edit
update
destroy
You can't generate Controller and specified the name of method which will be generate. The only way to generated controller with all CRUD methods It is when you generate a resource based controller
php artisan make:controller PersonController --resource
The other way is to generate Controller which is empty

Resources