I had this error "Invalid route action: [C:32:\"Opis\\Closure\\Serializable Closure\" while I was making a test closure function in the routes file and I have no clue what is going wrong
php artisan optimize did it for me!
I have checked most of the answers and nothing satisfied my curiosity but due to my deadline I can't investigate a lot so :
This worked for me, basically never write a closure function in the routes file !
I will update if I dug deeper and found a real solution but I solved my problem with this now
Just creating a test function into the controller and that's it
Related
It gives me this error
ArgumentCountError
Too few arguments to function Illuminate\Routing\Router::fallback(), 0 passed in C:\xampp\htdocs\gmvcc\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 338 and exactly 1 expected
im using laravel 9.
I suggest a combination of suggested places to check, based on the provided error response you pasted above:
First, check your web.php or api.php in routes folder and verify if you have unexpected additional parameters. For example, Route::post('/foo/{hello}/bar/{world}', [FallbackController::class, 'testFunction']); and we see that you'll next have to declared $hello and $world shortly.
Next, does your function looks like this? (following the example from #1) Such as public function testFunction($hello, $world, Request $request).
Third, based on the HTTP method used, and for the route defined using FallbackController, were you able to simplify it to test your HTTP method with the route again? For this, I still assume it is a route in api.php correct?
Lastly, if any of above fails to help, I recommend implementing a simple route to test with (GET or POST) first. This will help you trace back what you missed.
Using Docker (and a fresh Laravel 9) to help fill in other clues, like incorrect php or composer version and more - using a template like this might help, https://github.com/k90mirzaei/laravel9-docker.
Please note, I am answering based on the provided error first. Hope my checklist above helps.
Laravel project not working in cpanel faced error Target class [App\Http\Controllers\fileController] does not exist. But project completely running locally without no error.
Error image
route.php
AuthorController.php
Please help me out. Advanced thanks.
The error appears to be straight foward --You are appear to be missing the definition of the FileController and somewhere within your routes files you are calling the controller.
Route::resource('files', 'FilesController');
To fix an issue like this, make sure you had not renamed any of your controllers to a different name or you could simply run artisan
php artisan make:controller FilesController -r
to get past this issue. Also, try and stick to resourceful controllers as the verbs such as "PUT", "PATCH", "GET" etc. make decrease the readability of your code. If you don't with to expose all the method in a resourceful controller within your route you could have something like
Route::resource('files', 'FilesController')->except('index','show');
and so forth.
For some reason most of my pages are giving this error "Call to undefined method DateTime::getTimezone()". I'm kind of positive that the pages that have this error got a ->created_at->diffForHumans() function. I still have no idea whats causing this.. It has been working fine since forever.
I tried updating my packages but there was no luck there.. Searched around for the function itself or inside my controllers.. also no luck. Checked my time zone in config/app.php and it had the same time zone that I've always had which is Asia/Amman
Check this discussion please:
https://github.com/laravel/framework/issues/24886
As it say there:
This issue is closed as it is not an issue with Laravel; it was an
issue with the PHP docs at the time, which have since been updated. I
would suggest you review your own code and make sure it's not a
namespace problem (i.e. use new \DateTime instead of new DateTime) and
if you still can't figure it out, post a question on StackOverflow
with the minimum amount of code needed to reproduce the error.
Edit:
Since this was after a Composer update, I would guess that the problem
lies with one of the packages that were updated. The error message
should give you the exact line number producing the error, which
should help you determine what package is causing the error. Then file
a bug report (or pull request) against that package if possible.
I hope it helps.
I kept changing the php version and it eventually worked. It was 7.1.22 and I changed it to 7.2.* and it worked just fine...
I'm building my first app in laravel 5.4 and I did a custom 500 error view (resource/error/500.blade.php) and I was wondering if there is any way that I could force the error.
Obviously nobody would want to have this error, but I was just wondering how would it look if it occurs.
Thanks in advance
Add abort(500) snippet somewhere in the flow your testing to view the page.
Try:
App::abort(500);
Optionally, you may provide a response:
App::abort(500, 'What you want to message');
Link to the docs here
I am haveing trouble with getting a cron job to work with codeigniter
I have used these instructions.
https://www.codeigniter.com/user_guide/general/cli.html
But it is not working
Here is what I have.
php /home4/markwolf/public_html/propalert.asia/index.php admin_notifications index
But it is not finding the right controller or the method, instead it is going to the "default_controler". Everything else I've tried gets a 404 not found error.
I've been pulling my hair out for two days trying to get this to work so any help would be greatly appreciated.
Thanks
EDIT
This works:
wget -q http://propalert.asia/admin_notifications
But the problem with this method is that Codeigniter's method for protecting the script by checking whether it is accessed by cli returns false.
I came across this post at CI's forum describing the same problem.
https://ellislab.com/forums/viewthread/236475/#1055830
Unfortunately he never got an answer there either.
I finally found the solution:
/usr/bin/php-cli -q /home4/markwolf/public_html/propalert.asia/index.php admin_notifications index
the key is "php-cli" instead of "php".
But then there is a bug in the CI core that needs to be fixed. You can find the solution to that here:
https://ellislab.com/forums/viewthread/227672/