I have tried to debug this on my own to no avail and all related questions found have not helped.
I have a Lumen application I cloned from my online repo on GitLab that giving me this error:
In Facade.php line 239:
Call to undefined method Laravel\Lumen\Routing\Router::prefix()
Please how do I fix this?
My Lumen web.php route file seems to be working fine as follows:
$router->group(['prefix' => 'agent'], function () use ($router) {
$router->post('register-worker', 'UserController#registerWorkerByAgent');
$router->get('workers', 'UserController#getAgentWorkers');
});
but the PHP artisan command is still giving me an error. (see image)
For those that may come across this in the future.
I solved this by downgrading my php version to 7.2 from 7.4
As it turns out. Php 7.4 now returns null at the call of some illuminate functions. This was taking care of by downgrading to 7.2. I encountered this problem with a Lumen framework so I anticipate others might have similar issues as well.
Thanks for all the assists. Hope this helps someone.
Related
As I mentioned in the question, I just upgraded the Laravel version of my project from 5.8.* to 6.0.*.
Now I am getting the below error:
In AppServiceProvider.php line 32:
Call to undefined function App\Providers\studly_case()
Is Laravel supposed to throw error in it's own core file ? I was invoking the following command when I got this error, so I suppose this happens with any artisan command:
php artisan list
I saw in docs, that the new function is Str::studly from Str class file. Is it ok to change in the AppServiceProvider.php ?
Referring to the Laravel 6.x docs, I just discovered that the function for converting the string's current case to studly case is moved to Illuminate\Support\Str class, and named as studly().
So I added that dependency and then replaced the studly_case() to Str::studly() in AppServiceProvider.php, and then was able to run the artisan commands just like before.
I wasn't sure that changing AppServiceProvider.php is standard way or not, but it did worked so I am posting the answer here, that way it'll help anyone else facing the same issue.
After upgrading php to 5.5, the following error occurs:
PHP Fatal error: Call to undefined function bi_to_str() in /var/www/index.php
I know that it's not a coding error, but it could be a missing library. But could an empty value cause that error? Is there an easy way to load that library using apt-get in Debian?
Well with the help I received in the comments, I was able to come up with a solution.
It seems that it's just the function that is missing. I was able to create a file called big_int.php, fill it with the contents found here, and just link to it using require_once in index.php, like this:
require_once('big_int.php');
All is well. Many thanks to Barmar for the helpful tip.
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.
Since I've upgraded to Laravel version 5.6 from Laravel version 5.5 my Logger doesn't work properly anymore.
At first I got the following error stack :
laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. {"exception":"[object] (InvalidArgumentException(code: 0): Log [] is not defined. at /home/vagrant/Code/grotesmurf/vendor/laravel/framework/src/Illuminate/Log/LogManager.php:181)
which was solved by simply adding the new config/logging.php file that is provided by Laravel 5.6.
But now I'm getting no output from the Logger! I'm simply running \Log::info('hello!') as a tinker command, but it doesn't generate any log output anymore (same for scripts calling the \Log() method).
I've tried different LOG_CHANNEL settings (daily, single, stack), but none of these work.
Hope anyone has ran into this error already and is able to provide me with some suggestions. I have followed the upgrade guide and it doesn't help unfortunately.
Thanks in advance.
P.S. I'm running php version 7.1 & am on ubuntu.
P.P.S. I have cleared all cached config using artisan.
Well I have found the actual problem, we use an adjusted storage_path() method in our application and the new Logger is now using the storage_path() method to generate its path - this caused the log file to be created in a different directory than storage/logs.
i had the same issue, deleting the files in bootstrap/cache solved it.
I am following this laracast tutorial and as I key in this command in tinker:
factory('App\Flyer')->make();
I get this error:
PHP Fatal error: Call to undefined function factory() in eval()'d cod1
My php version locally installed is 5.4.38
So how do I get rid of this error?
PS: I want to avoid upgrading laravel at this stage as it would require me to update my php as well. So looking for some other workaround.
Model factories were added in Laravel 5.1 so it's obvious it won't work in Laravel 5.0.*
Reference: https://laravel.com/docs/5.2/releases#laravel-5.1