Class 'AlgoliaSearch\Version' not found - php

I am trying to add algolia search system into my laravel(5.6) web app. For this,
I followed below instructions
composer require laravel/scout
php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"
use Searchable trait into my User model
use Laravel\Scout\Searchable;
composer require algolia/algoliasearch-client-php
php artisan scout:import "App\User"
I also set (ALGOLIA_APP_ID) and (ALGOLIA_SECRET) both of my .env and scout.php file
I also added some dummy data to my users table and when I try to import those data to my algolia site by using (php artisan scout:import "App\User") this command I am getting this error (Class 'AlgoliaSearch\Version' not found)

I had the almost same problem
When I was doing the batch import using the command php artisan scout:import
got this Error:
In EngineManager.php line 31:
Class 'AlgoliaSearch\Version' not found
Downgrading the version fixed it
composer require algolia/algoliasearch-client-php:^1.27

Related

Laravel 8. Seeder class does not exist

This problem is not new, but I’ve looked and tried all the proposed solutions in other threads with no success.
I’m working with Laravel 8 with Homestead, is a new installation on a Windows 10 machine, not an upgrade.
I’m trying to seed a file called HotelSeeder.php. When I run the command
php artisan db:seed
I get the next error:
My HotelSeeder class goes like this:
My DatabaseSeeder class goes like this:
Both classes are located in the directory database/seeders
Autoload in composer.json goes like this:
After I run vagrant up and vagrant ssh, the commands that I’m running are:
php composer auto-load
php artisan db:seed
And the error shows up.
I've tried also:
php artisan db:seed --class=HotelSeeder
php artisan migrate:fresh –seed
php artisan clear:cache
php artisan optimize
Nothing seems to work. I hope you can help me.
Try the command:
composer dump-autoload --optimize
then:
php artisan db:seed
Your seeder class is named Database\Seeders\HotelSeeder. In your DatabaseSeeder.php file you should remove the alias for HotelSeeder as that is saying you want to alias a class from the root namespace named HotelSeeder which is not your class. If you remove that alias then the reference to HotelSeeder will actually be your correct class, Database\Seeders\HotelSeeder because the current namespace of this file is Database\Seeders so all class references are to that namespace.
Remove: use HotelSeeder;
Just a PHP namespacing thing.

Can not run Seeding on Laravel

Docker 18.09.2
Mysql 5.7
Laravel 5.7
PHP 7.125
I am new at Laravel and I have a problem When I use php artisan db:seed, this error appeared:
include(/var/www/laravel_app/vendor/composer/../../database/seeds/AdminsTableSeeder.php):
failed to open stream: No such file or directory
at /var/www/laravel_app/vendor/composer/ClassLoader.php:444
440| * Prevents access to $this/self from included files.
441| */
442| function includeFile($file)
443| {
> 444| include $file;
445| }
446|
I have no idea why does it happens.
There was no error when I used php artisan migrate.
I have already tried php artisan migrate --seed and php artisan migrate:refresh --seed.
Can anyone please help me?
You should try using composer dump-autoload.
From this answer in SO:
Basically, because Composer can't see the migration files you are
creating, you are having to run the dump-autoload command which won't
download anything new, but looks for all of the classes it needs to
include again. It just regenerates the list of all classes that need
to be included in the project (autoload_classmap.php), and this is why
your migration is working after you run that command.

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 not Found: Laravel Artisan via ssh

for a Laravel 5.1 project I am trying to setup a beta version of this project on a shared hoster. Everything works fine except for artisan.
I do login through ssh and move to the Laravel project directory and the not matter what php artisan command I use I get following error:
PHP Fatal error: Class 'Illuminate\Queue\ConsoleServiceProvider' not found in /www/htdocs///vendor/laravel/framework/src/Illuminate/Foundation/Application.php on line 543
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Illuminate\Queue\ConsoleServiceProvider' not found
Any ideas on what could be wrong?
The autoloading should work correctly as the project works fine using the browser.
The steps by #manix helped me a lot:
Delete file bootstrap/cache/services.json
call composer update
run php artisan optimize

Why there are no commands defined in the make namespace?

I have installed laravel via composer. I have created the database I need and I'm just trying to add the models I need. So I have tried the artisan command :
php artisan make:model Task
but it returned the following error :
[InvalidArgumentException]
There are no commands defined in the "make" namespace.
Maybe I have to install other components for artisan ? How can I fix this?
No make command in laravel 4, I have upgraded my laravel application to 5.1 and now it is working

Categories