I am trying to use Laravel Scout Searchable into my model but it gives me an error
Undefined type 'Laravel\Scout\Searchable'.
I have already included
use Laravel\Scout\Searchable;
in the code. Could someone please tell me what am I doing wrong here?
I have followed the documentation as is until this point.
After a little bit of tinkering around I found the answer myself.
The error was produced by PHP intelliphense plugin of VS Code. It seems there is a problem with a version of the plugin I used. I downgraded my version one step and now it detects everything correctly.
Related
I have a Laravel 5.1 install that I am upgrading. I meticulously followed the instructions available at https://laravel.com/docs/5.3/upgrade#upgrade-5.2.0 for the upgrade, including removing Illuminate\Foundation\Providers\ArtisanServiceProvider and Illuminate\Routing\ControllerServiceProvider from the config/app.php file (I am stressing this point, as googling for this issue has suggested this in every response).
Despite this, I am still getting this error when I run composer cache:clear
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Illuminate\Routing\ControllerServiceProvider' not found error
and see this error in my browser:
FatalThrowableError in ProviderRepository.php line 146:
Class 'Illuminate\Routing\ControllerServiceProvider' not found
Thinking that perhaps references to these classes were being cached, I checked bootstrap/cache/services.json and removed the references from there as well and then ran composer dump-autoload but I am still getting this error.
I also made sure to copy over example config/app.php from Laravel 5.2 clean install example here: https://raw.githubusercontent.com/ziyed/Laravel-5.2/master/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php
I have read through the similar threads on StackOverflow and Laracast and tried tried to use the advice contained inside, but nothing seems to work.
Any help would be greatly appreciated. For reference, my dev setup is running on a local XAMPP stack under a Windows 10 OS. The other environments are remote, using a traditional LAMP stack with Amazon Linux 2. I was trying to do the upgrade locally.
Illuminate\Routing\ControllerServiceProvider is not present anymore.
When I recently had to upgrade the same versions as you, I had to run composer update before and after removing Illuminate\Routing\ControllerServiceProvider::class and Illuminate\Foundation\Providers\ArtisanServiceProvider::class to make it work. Also worth to mention you need to clear bootstrap/cache. It worked for me.
Edit: i noticed now you tried the last step partially as well. You can remove all php files from cache.
I am closing this question, not because I found an answer, but because continuing down this path just didn't pass a cost/benefit analysis. After upgrading to 5.2, the next upgrade would be 5.3, and the breaking changes between 5.2 to 5.3 is a lot higher than between 5.1 to 5.2. After some thought, it was obvious that the better approach would be a fresh install on my target version, and then start porting over each module in my project by copying over the views, updating the routing, and making changes to the controllers and middleware as needed.
Or just using Laravel Shift.
Thank you to everyone who chimed in with suggestions!
I started working with Laravel. Faced a FatalErrorException:
Declaration of SessionHandlerInterface::1($save_path, $session_name) must be compatible with SessionHandlerInterface::1($maxlifetime)
in FileSessionHandler.php line 10
It was working yesterday, and as far as I remember, I have not updated anything.
I tried to look into file FileSessionHandler but I can't figure out the problem. I also tried to look for SessionHandlerInterface, but I am not able to find the Interface file.
How can I solve this problem?
Also please tell me the meaning of 1 after scope resolution operator.
I'm interested in adding QR Scanner to my Laravel project, I found one that suits me it's called gruhn/vue-qrcode-reader there is also a written tutorial how to install it, but I just don't know where to add those codes or files. I've installed everything the problem is that I just don't know what to edit and how.
This is a late response: but for anyone who comes across this like me...
gruhn/vue-qrcode-reader was created using VueJS a Javascript Framework. Since you use Laravel: VueJS already comes preinstalled with Laravel depending on the version you use. You should also have Npm in order to use the npm run watch (the watcher).
Follow the installation steps found at their GitHub and then Simply create a new VueJS component and paste the code found in GitHub: gruhn/vue-qrcode-reader: while having a little understanding you can easily integrate this with Laravel by mounting the component where you wish to have the scanner in your project and viola it should work as advertised.
I hope this helps a bit.
You should try this one laravel package:-
https://github.com/werneckbh/laravel-qr-code
It would be best for you, because there are only few steps and that are too easy.
I have a problem with my laravel website while I am hosting it to online server it gets an error says
There is no suitable CSPRNG installed on your system
I searched the question. But I found nothing that helps me.
Please if someone know how to handle this problem I will be so grateful. Thank you!
The program is coded with laravel 5 and php 7
I also got surprised by this error after upgrading Symfony. Try this article, the first solution fortunately worked for me:
How to solve PHP 7.0 Polyfill : There is no suitable CSPRNG installed on your system - paragonie/random_compat:
Although you're not using directly this library, add it to your composer.json as a dependency. Require random_compat with the specific version 1.4:
{
"require": {
"paragonie/random_compat": "~1.4"
},
}
Then run composer install (or composer-update if you're already using this library) and try to run your project again. If it didn't work try downgrading to 1.3, if it doesn't work neither, then i hope you have the rights to modify PHP settings in your server and go to the next possible solution.
Have you tried these links
https://github.com/paragonie/random_compat/issues/99
https://laracasts.com/discuss/channels/servers/there-is-no-suitable-csprng-installed-on-your-system
?
Seems like you are facing a similar issue.
Sorry for answering, and not commenting. I don't have enough reputation yet to comment!
this question may have been asked, but i could not find it so far.
i'm new to laravel (5.1) and phpstorm (v9) and trying a simple controller with a view and route.
I noticed that while typing the code for example:
View::make('someView');
if i ignore the autocomplete (intellisense) and complete the code.
i get a "NotFoundHttpException in RouteCollection.php" error.
But if i apply the suggested autocomplete for example:
Illuminate\Support\Facades\View
it works fine.
May be i've missed some configurations on Laravel or phpstorm or both, may be this issue is in only phpstorm v9. Either ways it sometimes give me a headache, specially as i just started learning.
Btw, even if i've
use Illuminate\Support\Facades\View;
for ever function that i write i still have to apply the autocomplete suggestion.
else i get the same View not found error.
Please let me know if there is a way to fix this.
Thanx
Install barryvdh/laravel-ide-helper package and follow instructions. It will create helper files that will improve you IDE autocomplete for Laravel project.