I have enabled Laravel authentication using this command: php artisan make:auth. But now I want to get rid of this. Is there any command or a way so that I can do it and remove the effect? Thanks.
There is no command to undo it, but if you check the command at Illuminate\Auth\Console\MakeAuthCommand, you can see what is being changed. If you want to undo it, delete these files & folders if you did not create them:
Files to be removed:
app/Http/Controllers/HomeController.php
resources/views/auth/login.blade.php
resources/views/auth/register.blade.php
resources/views/auth/passwords/email.blade.php
resources/views/auth/passwords/reset.blade.php
resources/views/auth/passwords
resources/views/auth
resources/views/layouts/app.blade.php
resources/views/layouts
resources/views/home.blade.php
And in your routes/web.php, delete these lines:
Auth::routes();
Route::get('/home', 'HomeController#index');
EDIT: Laravel 5.6
The MakeAuthCommand was renamed to AuthMakeCommand. Generated files has not been changed. Only the generated routes has been changed slightly:
Auth::routes();
Route::get('/home', 'HomeController#index')->name('home');
Related
I have the following issue. I am running laravel 5.4 and have a problem with my routes, when I navigate to my '/about-me' of my predefined routes I get the error:
1/1 NotFoundHttpException in RouteCollection.php line 179:
However the route is defined as shows here:
Route::get('about-me', function () {
return view('about-me');
});
On my view the link is pointing to that route as shown:
About Me
I have cleared my cached routes in SSH using the command:
php artisan route:clear
When I list my routes using the command:
`php artisan route:list`
I see an old version of my routes file. So this is the problem, however whatever I try they are not updating. I have cleared the cache locally and within laravel and still the old file file is showing when I type the route:list command.
I believe the code is all correct, however the new updated route file which contains the defined route for about-me is not being used. I have attached an image of the updated routes file on the server also.
Here is a link to the screenshot. Screenshot of route file on server
Thanks
In Laravel 5.4 (or in earlier version, I'm not sure) routes has been moved to the separate folder in app/routes/web.php (as you can see here: https://github.com/laravel/laravel).
You can find routes registration in app/Providers/RouteServiceProvider.php (https://github.com/laravel/laravel/blob/master/app/Providers/RouteServiceProvider.php#L52)
When i m executing PHP artisan migrate I'm getting following error
C:\xampp\htdocs\Social>php artisan migrate help
[ErrorException]
include(C:\xampp\htdocs\Social\vendor\composer/../../app/Http/Controllers/A
uth/AuthController.php): failed to open stream: No such file or
directory
C:\xampp\htdocs\Social>php artisan migrate
[ErrorException]
include(C:\xampp\htdocs\Social\vendor\composer/../../app/Http/Controllers/A
uth/AuthController.php): failed to open stream: No such file or
directory
C:\xampp\htdocs\Soci
how to solve this problem please help???
It looks like you're trying to use Laravel auth system by adding Auth::routes(); (Laravel 5.3+) or Route::auth(); (Laravel 5.2) to the routes file, but you didn't create controllers and views. So, you'll need to remove the line from the web.php and run this command:
php artisan make:auth
After that put Auth::routes(); back to the web.php. Or Route::auth(); to the routes.php if you're using Laravel 5.2 and lower.
https://laravel.com/docs/5.4/authentication#authentication-quickstart
Run composer install in your root project folder (or php composer.phar install)
What is the best solution if I want to rename my laravel 5.1 project, I just tried to rename one but it did not work properly got some errors.
Are there some kind of steps one has to do to rename a laravel project?
You should use php artisan app:name command to rename your app. It will change namespace in all project files for you. This is the only right way to rename your app.
https://laravel.com/docs/5.0/configuration#after-installation
From laravel version 5.3^ there is a function to call the app name
config('app.name');
You can change the default name 'Laravel' inside this file
config/app.php
'name' => 'Laravel',
And also inside .env file
APP_NAME=Laravel
I just recommend to:
go to .env file at APP-NAME =
put your desired name in "" (double quotes)
restart your server
And you're done.
You can change your project name using the following command:
php artisan app:name your_git_name\your_app_name
I have simple question on Laravel 5.1. I have created a controller using php artisan command:
php artisan make:controller PageSettings
However it was mistake, because I really wanted to create this controller in Admin folder like this:
php artisan make:controller Admin/PageSettings
Now I want to get rid of my old PageSettings controller. Is it ok just to delete my old PageSettings.php manualy? Or there is something more what needs to be done?
If you only created it and found that you did it wrong, you can manually remove the file and that's it. However when you already added routes to this controller in routes.php you should remove them from routes.php file or alter the file to reflect your new controller.
It is OK to manually delete controller. Just check routes.php if you have some route to that controller and delete it also.
I had an issue with just deleting the file. I tried running my PHPUnit test suite and got an error that looked like this:
Warning: include(): Failed opening '/user/home/me/some/file.php' for inclusion (include_path='.:') in /usr/home/me/some/vendor/composer/ClassLoader.php on line 444
I had to run composer update then composer dump-autoload. After that, everything worked just fine.
Yeah, you can delete manually without tension.
I will suggest you for avoiding more mistakes, you "phpStrom" software, from using this, if you delete manually any file from by click right of mouse->Refactor->safe delete then before deleting they will give all places which were using your file. by clicking "do refactor" you can delete it.
Here's my routes.php:
<?php
Route::get('/', 'StaticPagesController#index');
Route::get('about', 'StaticPagesController#about');
Route::get('contact', 'StaticPagesController#contact');
Route::get('signup', 'StaticPagesController#signup');
Route::get('login', 'StaticPagesController#login');
Route::post('login', 'LoginController#index');
i'm running my site locally via php artisan serve
d:\xampp\htdocs\some-website>php artisan serve
Laravel development server started on http://localhost:8000/
everything works fine. i can access each page (about, contact, signup, login) with no errors.
however, when i use XAMPP, i can only visit the index page:
localhost/some-website/public
i get a NotFoundHttpException in RouteCollection.php line 143 whenever i visit one of the following:
localhost/some-website/public/about
localhost/some-website/public/contact
localhost/some-website/public/signup
localhost/some-website/public/login
EDIT:
i tried editing my routes.php file to:
<?php
Route::get('/', 'StaticPagesController#index');
Route::get('/about', 'StaticPagesController#about');
Route::get('/contact', 'StaticPagesController#contact');
Route::get('/signup', 'StaticPagesController#signup');
Route::get('/login', 'StaticPagesController#login');
Route::post('/login', 'LoginController#index');
but no luck.
so it turns out my problem was with the project's folder name. i had it in CamelCase notation. changing it to lowercase got things sorted out.
shoutout to those who helped!