I am new to laravel.
I was in middle of my project. I googled for login validation in laravel 5.
I found this command
php artisan make:auth
it Created several classes and also modified my welcome.blade.php
there was several code in welcome.blade.php.
Now How to rollback effects of this command.
Please Help.
Look at the make:auth command source code to understand what exactly files this command added or changed and revert changed back.
manually you have to remove following files
auth/login.blade.php
auth/register.blade.php
auth/passwords/email.blade.php
auth/passwords/reset.blade.php
layouts/app.blade.php
home.blade.php
Go to routes/web.php, delete the created routes by the command make:auth. Remove these two lines and your project will work fine as before.
Auth::routes();
Route::get('/home', 'HomeController#index');
The answer is NO.
There is no way you can rollback make:auth command as yet in laravel..
You can remove auth manually be removing auth from app controller and and auth route. And if you were lucky enough to have welcome file opened in some IDE then there was a chance of ctrl+z bcause IDEs keep back in memory,., but other then that there is no way retrieving backup the data.
we can simply remove below line form wep.php routes folder.
Auth::routes();
Route::get('/home', 'HomeController#index')->name('home');
you can also remove the view files: like auth folder ,app.blade.php, home.blade.php
Related
I am currently working on an API only laravel application. In the controllers folder, there is an API folder that holds all controllers. The ForgotPasswordController is in the API folder as well.
When I run the command php artisan route:list I get the error below
Illuminate\Contracts\Container\BindingResolutionException : Target class [App\Http\Controllers\Auth\ForgotPasswordController] does not exist.
There is actually no ForgotPasswordController in the Auth folder. How do I handle this issue?
You have to make sure you are doing php artisan route:cache priority.
If the problem still persists, can you disable the auth provider and try?
For the sake of time considering that the project is live and I need to churn out a couple of features, I have moved both ForgotPassword and ResetPassword controllers back into the Auth folder. Ran a test to make sure nothing has been broken (everything works fine) and now I am able to list out the routes.
If you have Auth::routes() or Route::auth() in your routes file that would be generating routes to the ForgotPasswordController.
You would need to not be calling that or you would need to pass the proper option to it to have it not register those routes:
Auth::routes(['reset' => false]);
Depending on the version you are using this may not work. If that is the case you will have to not use this method at all and register the routes you want/need yourself.
So I've downloaded Laravel 5.5, and I ran the following command
in my terminal. php artisan make:auth and when I reloaded Laravel, the links for Login and Register show up but when I click them, it says Not Found.
I've tried resetting artisan and deleting my tables, and re-migrating artisan too, but none of them work.
php artisan make:auth
And heres my web.php file.
Route::get('/', function () {
return view('welcome');
});
Route::get('/post', 'PostController#index');
Auth::routes();
Route::get('/home', 'HomeController#index')->name('home');
Auth::routes();
Route::get('/home', 'HomeController#index')->name('home');
Have you checked your project's directory tree after executing it?
Did you run the migrations?
If you did all that it should scaffold all of the routes and views you need for authentication. But if it still does not work properly, then you might have to uninstall Laravel and install a fresh distro.
Can you add your web.php file under the routes directory please ?
It's probably a route problem.
Thank you.
It is because of anchor tag is not work...it may be some syntex error or spelling mistake
maybe ragister.blade.php have some problem
I Blog in Laravel v5.6
when translate new route it doesn't work for me
but old route like login and register and landing pages it working as well when i going in new route it's not
Switch Lang page
Route::get('locale/{locale}', function ($locale) {
Session::put('locale', $locale);
return redirect()->back();
// this link will add session of language when they click to change langauge
})->name('locale');
Route::get('/{username}', 'ProfileAccountController#index')->name('profile')->middleware('admin.user');
when i going to this route it's not working and navbar and footer it's back to key, remove all code in this page and test the lang it's not work too.
I use all of this command and nothing
php artisan config:cache
php artisan config:clear
php artisan cache:clear
php artisan view:clear
php artisan clear-compiled
Thank you.
My suggestions:
Use middle-wear for changing languages and use https://github.com/spatie/laravel-translatable like this for more comfortable usage.
Also check this Change language in Laravel 5 might help you.
Had similar issues with Route closures. Try moving you're session setters/getters to a Controller and not within a Route closure.
https://laravel.com/docs/5.7/session#using-the-session
This will probably solve your issues.
I created a Laravel app with a basic master.blade.php, header & footer and then my home.blade.php.
In my routes.php, I have:
Route::get('/', function () {
return view('home');
});
This was working fine until I ran the php artisan make:auth command. Now I have this in my routes:
Route::auth();
Route::get('/home', 'HomeController#index');
And my previous home page I created is now using the new views that it auto created.
What's the correct way to get back to my previous home design?
Laravel docs says that only run it on fresh installation. You did not. Simple.
If you are using git, just revert to an earlier version.
Maybe you can get something using file recovery tools too.
I don't think there is a clean general solution for you, sorry.
I am new on laravel, and I am making some test and following a tutorial. The matter is that I don´t know what I did two days ago that I got any defaults controllers (maybe only one... I don´t remember, for example: HomeController). I removed the project and create a new one... but now these defaults controllers don´t exit. And my routes.php on app/http folder is like this:
Route::get('/', function () {
return view('welcome');
});
ONLY THIS!!!
I remember that the routes.php file of the first laravel test project had something like: get("home")... or get("login"), etc...
Do I need to install them via artisan or something?
When installing Laravel, i. e. with this command composer create-project --prefer-dist laravel/laravel blog, there is no app/Http/Controller/HomeController.php generated.
You only get one route in your routes.php. That's it!
What you could do, of course, is:
Create a class HomeController.php in app/Htpp/Controllers - use php artisan make:controller HomeController
Change the route in your routes.php to utilize the new HomeController
Route::get('/', 'HomeController#index');
Another thing you may did in the past was running php artisan make:auth to initialize basic controller ands views to get a scaffold for logins/registers of users.
Maybe authentication? It will create some views and routes.
https://laravel.com/docs/5.2/authentication#authentication-quickstart
The command php artisan make:auth if you are using 5.2.*
no you don't if you want to create a controller just tphp artisan make:controller HomeController and a controller will be created for you :)