Laravel 5.1 using phpstorm code completion issue - laravel

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.

Related

Unable to use Searchable in laravel model

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.

How to get IDE to recognize methods used by Laravel Routes? (PhpStorm)

PhpStorm uses yellow font for method names if it detects that the method is in use elsewhere in the app.
It uses a grey font for unused methods.
This is really helpful for identifying stale code.
But PhpStorm doesn't recognize my methods that I am using in the /routes directory since they are called magically from a string.
For example, I am only using the sendPayout method in /routes, but the chargeCustomer is called directly from within another method.
For example, this line in /routes/web.php should ideally force the sendPayout method shown in the screenshot to appear in yellow font.
Route::post('/api/send-offer','StripeController#sendPayout');
Is there any way to get PhpStorm to recognize this, either by changing settings or using a certain plugin?
I am using PhpStorm 2019.3.1, MacOS Catalina version 10.15.2, and Laravel 5.8. I already have the Laravel plugin installed to PhpStorm.
Per #LazyOne's comments, the plugin "Laravel Idea" does solve the recognization issue for all Symfony and Laravel methods that aren't already picked up by PhpStorm's default. I definitely recommend this plugin now that I am using it.
There is special file for this called '.phpstorm.meta'. So you can "map" methods. Read more here: https://www.jetbrains.com/help/phpstorm/ide-advanced-metadata.html

not autocomplete local file when call in Visual Code

when in visual code call file not autocomplete
example this code :
#extends('layout.layout')
when write "layout" not autocomplete
excuse me, I cant speak English well
"Laravel Blade Snippets" provides shortcuts for writing Blade code in Laravel views, so there's no intellisense for it to read through your views folder.Here's an extension that claims to provide autocomplete for view files, I tried to fiddle around with it myself and couldn't get it to work though. I'll also add, that my experience with extensions that add file path completions can really slow down VSCode.
I think if you're looking for more robust features like intellisense/auto completion for a framework like Laravel, you should check out PHPStorm. It requires a paid subscription after a 30 day trial but is a great IDE for Laravel, be careful though because it will spoil you if you decide to stop paying for it and go back to VSCode for Laravel development!
One more note, during my rather quick research for VSCode Laravel extensions, I saw a few people mention Sublime Text has some good plugins for Laravel development. So there's another option for you to check out, good luck!

Laravel QR code scanner

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.

Laravel Homestead: Failed to mount component: template or render function not defined error

This problem is driving me mad, I have been researching and have read about the standalone and runtime version of Vue. As far as I can tell Laravel 5.4/homestead ships with the standalone version as default.
The Vue development tools in chrome show the example component so I think that part is working correctly, just cannot render the template.
I am relatively new to Vue and npm been stuck in the past with jQuery, firstly where in laravel can I check/set I want the stand alone version of Vue? If it is not that problem does any one have any ideas?
Thanks for help
VueJS supports two ways of building apps like you said.
Load all necessary scripts within your page via script tags (not combined .vue files).
Compile and bundle all your files with Gulp, Browserify, Webpack or other tools.
Can you explain what you did so far. I guess you don't compile everything down.
The comment by peaceman was the solution, I had multiple calls to elixir, I condensed down to one and it worked straight away. Thanks everyone for your help.

Resources