Undefined type 'Validator'.intelephense(1009) - php

Can anyone help me with this error? Im new to laravel and i was making a productController file but im getting this error from Validator:
I have called use Validator; What else can i do

Install the following package:
composer require --dev barryvdh/laravel-ide-helper
After, run:
php artisan ide-helper:models
php artisan ide-helper:generate
php artisan ide-helper:meta
And finally, install this extension on your vs code: https://marketplace.visualstudio.com/items?itemName=georgykurian.laravel-ide-helper
Also, another good to have (optional): https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client
It should solve your problem.

Related

Can't Run PHP artisan commands

I am trying to run Front-end project built in Laravel blade PHP locally.
i did the following commands:
1- Composer install --ignore-platform-reqs.
2- Composer update --ignore-platform-reqs.
during the process i get the error in image attached
and what ever PHP artisan command i try to run like PHP artisan serve or PHP artisan package:discover
i get this error in the image attached.
What should i do?.
Note: I did install PHP v8.1.2 and Composer.
fatal error image
Looks like it is a version mismatch. Use PHP 7.x instead.

How to Install Swagger to Laravel 8 API for documentation?

Installing Swagger for the First Time in laravel 8
composer require "darkaonline/l5-swagger"
composer require zircote/swagger-php
php artisan vendor:publish --provider "L5Swagger\L5SwaggerServiceProvider"
Getting Error like:
I'm guessing the URL you're hitting might be incorrect. Change it to just docs/api-docs instead of docs/api-docs.json. In addition, if you haven't ran the generate command already, you would have to do so to make it work.
php artisan l5-swagger:generate

Call to undefined method [loadRoutesFrom] error in laravel 5.2 after installing jeremykenedy-laravel-logger package

I have installed jeremykenedy-laravel-logger package to record the activity but after installing when I tried to migrate the table its showing Call to undefined method [loadRoutesFrom] error how to fix it?
package link:-https://github.com/jeremykenedy/laravel-logger
Please run below command in your term :
composer self-update
Try to run php artisan config:cache
then
run also php artisan dump-autoload
after your installation.

laravel laravelLTE installation issue

I followed the following instructions:
First, I ran:
composer create-project --prefer-dist laravel/laravel laravelLTE
cd laravelLTE
php artisan migrate
...which results in the following error:
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'App\Providers\Schema' not found
Then, I modified laravel/app/Providers/AppServiceProvider.php and retried php artisan migrate, but I see the same error as above.
Next, I tried installing the LTE admin template package:
composer global require "acacha/admin-lte-template-laravel:4.*"
...and then added: Acacha\AdminLTETemplateLaravel\Providers\AdminLTETemplateServiceProvider::class and 'AdminLTE' => Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::class to the 'providers' and 'aliases' arrays in config/app.php.
After running, composer update, I see the same error as above, followed by this error:
Script php artisan optimize handling the post-update-cmd event returned with error code 255
Finally, I ran this command:
php artisan vendor:publish --tag=adminlte -force
...which results in this error:
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Acacha\AdminLTETemplateLaravel\Providers\AdminLTETemplateServiceProvider' not found
What am I doing wrong? I am using Laravel 5.4.36 and PHP 5.6.25.
Also, I am having a problem setting the domain or URL to e.g. laravel.dev.
Go to App\Providers and In the AppServiceProvider.php, you did not include the necessary use statement at the top of the file.
use Illuminate\Support\Facades\Schema;
That defines the namespace path to the Schema class so you can simply call
Schema::defaultStringLength(191);
in the boot method.

Class 'Jenssegers\Mongodb\MongodbServiceProvider' not found

I want to use https://github.com/jenssegers/laravel-mongodb for connecting to Mongodb with laravel 5, i have installed MongoDB php driver and then laravel-mongodb with command composer require jenssegers/mongodb, then added service provider in app/config/app.php:
'Jenssegers\Mongodb\MongodbServiceProvider',
and refreshed my website, unfortunately i got error ->
FatalErrorException in compiled.php line 6466:
Class 'Jenssegers\Mongodb\MongodbServiceProvider' not found
how can i fix it?
run composer dump-autoload or php artisan optimize
I didn't have the archive:
myproject/vendor/jenssegers.
I installed this archive by command:
$ composer require jenssegers/mongodb
Delete Following Files and Use This Step :
composer.lock
bootstrap/cache/config.php
if exist
bootstrap/cache/services.php
then Run this command :
composer install
php artisan config:cache
If the previously mentioned solutions won't do the trick, it is possible that some dependencies are missing. Simply try:
$ composer install

Categories