Laravel 4 - NotFoundHttpException only for NEW Routes - php

I've picked up a project that was developed using Laravel 4.2. I've deployed it to my testing server (a Bitnami LAMP) and everything works as it's supposed to. HOWEVER, new routes that I create don't work, getting the error NotFoundHttpException.
I've gone through a few recommendations, but nothing has been successful thus far.
Any thoughts or ideas??
Thanks!
--
Just to clarify, any NEW route throws the same Not Found error. Even the simplest one like:
Route::get('test', function(){
return "This is a test";
});
It seems like Laravel is only serving an old version of the Routes.php, is this even possible???

Resolved this by recreating the project using Laravel 5 instead.

Related

404 error when adding a different route - Laravel dead simple routing

I've been laraveling for 5 months now but I reformatted ubuntu and installed Laravel, this time, it's Laravel 7 instead of Laravel 6. My problem is simple routing giving an error. It's so dead simple you might think I'm a stupid beginner.
In my Web.php
Route::get('/about', function () {
return view('welcome');
});
Route::get('/', function () {
return view('welcome');
});
I also tried using a controller that returns a view and just a simple "string" in Web.php
Route::get('/about', 'UserController#index');
Typing http://localhost/about in the address bar in chrome causes 404 error.
As you can see, there should be no problem returning the same view('welcome'), even if I return a simple return "TEST";, results are the same.
I tried downgrading to Laravel 6 by deleting vendor, changing the Laravel v6 in composer.json and running composer install but still the same, so I think it's not the version.
This has never happened to me before even when I first started with Laravel 6 five months ago and it's a totally fresh project.
enable rewrite_mode of Apache server and restart Apache server it will solve the issue.
Run server with php artisan serve
and then try http://localhost:8000/about hope it will fix your problem
OR
Simply use http://localhost/project/about

Call to undefined method Illuminate\Routing\RouteFileRegistrar::get() - Error after upgrading from Laravel 5.7 to 5.8

I have a running app written on Laravel 5.7. I tried to change the record in composer.json to match "5.8.*" and ran composer update. On my local (win10/WAMP) machine it went fine, but on the staging server (Debian 9/nginx) the update command changed the vendor contents and failed at the end.
Since then anything I do with the app on the server I get this error and I can't find any information anywhere.
Call to undefined method Illuminate\Routing\RouteFileRegistrar::get()
And this is the line that fails:
$this->get('login', 'Auth\LoginController#showLoginForm')->name('login');
Thanks in advance!
remove "$this" from your routes and use "Route::"
It is a problem with the routes. Mainly, you get this problem when you are using routes with resource or resources. Make sure you do not have any problem in routes by using the command:
#php artisan route:list
If you are getting any problem while route listing please fix it.
I solved this problem in Laravel 5.8 by fixing routes.
Hope this will help.

PHP laravel 4.2 API Routing URL with postman

I'm new to laravel4.2 trying to create a RESTFUL API, but getting error when I'm trying to hit URL{localhost/TPM/public/api/books} in postman.
what would be the URL for this??
Controller:
Router:
Try with return Response::json(['result' => true]); in your index method.
In addition, you can check the logs file for clues of what's going on in storage/logs/laravel.log.
I think in Laravel 4.2 you needed to perform a composer dump-autoload if created new classes but not sure.

laravel 5.3 Auth::user() not found

I am struggeling to get user authentication correct in a laravel 5.3 project.
To be sure of the configuration, I just started from a brand new project, but still no progress.
So these are my actions so far using https://laravel.com/docs/5.3
first downloading the latest laravel project
composer global require "laravel/installer"
then installed using
laravel new website
opening this, shows me the laravel standard template, so I consider this as a successfull installation
now, I try to use the Auth module as described in https://laravel.com/docs/5.3/authentication#retrieving-the-authenticated-user
showing:
I updated this in Controller.app, but "Auth::user()" is not possible as seen in this screenshot
This raises questions for me:
what do I do wrong to get Auth::user() working as described in the manual?
in laravel 5.2 I could write "use Auth;" in the controller using the alias as described in app.php, now the alias is found while tiping "use Auth", but still the "use ...." is written full after I type the alias and press enter. If I type "use Auth;" without pressing enter, the Auth throws an "undefined class" error. Is this an optional setting to use the alias names? or error in laravel?
Thank you
Read the Authentication Guide.
You probably forgot to run php artisan make:auth.

Laravel: Routing Not Working

I googled the matter and there are many who've had this issue, but each had his own very unique case, and at the end nothing I read helped me.
I just finished installing Laravel with xampp, hopefully properly. Apache and MySQL are running.
I'm starting with the very first tutorial:
http://laravel.com/docs/4.2/quick#routing
My app root is:
http://localhost/Laravel/tests/app/
The hello.php file is working for me, I even tested some php code (plain not laravel) and it worked:
http://localhost/Laravel/tests/app/views/hello.php
As the tutorial instructed, I added in app/routes.php:
Route::get('users', function()
{
return 'Users!';
});
but when I try to access
http://localhost/Laravel/tests/app/views/users
I get "Object not found!" while I should be getting the text "Users!"
This is not route correct, test with: http://localhot/Laravel/tests/public/users

Categories