Algolia error when trying to reindex() - php

I'm using the PHP version of AlgoliaSearch with a laravel 5.2 installation.
I created a command I can run to reindex the data I have for one model. It works perfectly on some other but it seems that one has a problem.
When I try to run
\App\Models\User::reindex();
I get this exception :
AlgoliaSearch\AlgoliaException: cannot move with a master/slave index as source
I guess there is a problem with the way I configured my index and its slaves but I have no clue on that.
Does someone has more info please ?

Related

Laravel migrations won't apply on MySQL (InnoDB)

Hello everyone,
This is my first time posting !
I am running into a problem when applying laravel 8 migrations on my new web server.
While trying to deploy my projet I'm unable to apply migrations and I'm not sure why.
Below images of the error and my migration, i'm using the php artisan migrate --seed command
Outputed message when migrating:
My migration with foreign keys:
The problem seems to be associated with the foreign key constraints but it's maybe because of something else. My server is running MySQL on InnoDB so I'm suspecting a compatibility problem, still, I have no clue how to solve it.
I tried:
Applying migrations one by one so that constraints would reference already existing foreign keys. Didn't work
Changing my engine to InnoDB in config/database.php. Didn't work
Importing my database manually using command line. Didn't work
Adding DB_ENGINE = InnoDB to the .env file. Didn't work
Switching from $table->foreign('idUser')->references('id')->on('users');
to $table->foreignId('idUser')->nullable->constrained();
My server
Centos 7
MySQL - InnoDB
PHP 7.4
Has Cpanel
Also, I have no problem applying the migrations on localhost, whitch leads me to believe this is not a problem with the structure of the migrations...
I am running out of ideas and can't seem to find a good awnser on the internet. Can someone help me ? Also please let me know if i forgot to provide important information
The problem was in fact with the way I wrote my migrations, if someone else has this problem, you can find a good awnser here: laravel-8-foreign-key
Thank you #brombeer for helping me !

Is there a way to remove algolia/scout from laravel?

im am new to laravel and I recently installed Alogila on my Laravel application as I was working on a searching functionality using Laravel scout. The command I typed was composer require algolia/scout-extended
I am getting an error saying Impossible to connect, please check your Algolia Application Id.
Since I have decided to not have a searching functionality in my application, I would like to remove algolia from my app. I am unsure of how to do this, any help would be much appreciated.
You have two way to do that
first way
run the command
composer remove algolia/scout-extended
Second way
remove it from your composer.json file
then run the command
composer update

I can't generate migration file with make:migration command in Laravel

This happened to me a couple of months ago. It might have happened in the process of a composer update, but I'm far from sure on that one. I've even updated my project to Laravel 5.3 and it still I can not get make:migration to work through Artisan. No the project it updated to 5.4 and it still do not work.
I've checked out this thread and I have the exact same problem. The symptoms were exactly the same, however the OPs solutions did not work for me.
I get no error or result in the terminal when running make:migrate.
I can generate any other file through Artisan it seems.
I tried to create a new model and pass the -m along with it. Didn't work.
I've checked permissions (and even changed migration folder), but didn't
help.
If I create my own migration-file the rest of the process through artisan works fine (migrate, DB-manipulation etc).
I've tried with different terminals and computers.
Since project were upgraded and even reinstalled I fear it has
nothing to do with the deep kernal. However maybe some sort of conflict from the higher level.
And in the last phase of my quest I tried to figure out what user interacting elements that can possibly effect the make:migration. Nothing worked.
I searched the web without any solution, then I gave up on that project and started to make my own migration files. However I now got some new hope when I saw that other thread.
After some troubleshooting I finaly managed to figure out the problem.
I narrowed it down to have something to do with the config/app.php-file.
Seems I in this project had typed in:
'timezone' => 'UTC+2'
This made creation of migration-files come to a halt without error messages. And it effected only the creation of migration-files (at least what I noticed).
I changed it to 'UTC' and it worked liked a charm again.
Note: the 'UTC+2' worked in the application and I never saw any other indications of errors regarding the rest of the app.php-file, or in the application in general.
Solution: When I instead used the parameters from this site it all worked perfectly again.

Routes.php not working just being completely bypassed

So I have been working on Laravel projects with no issues at my new job, however I decided it was time to get it up and running on my system at home which for purposes of this question is running MS Windows 10. I managed to get it all set up correctly, however upon trying to get the test app working just to make sure everything was correctly configured, I am unable to get passed the laravel welcome (welcome.blade.php) despite having the Routes.php file in place.
The clean project was git cloned directly from laravel/laravel and I had no issues with this working on my work computer when I very first started learning Laravel. I'm not getting any errors, the routes are simply not working!
Btw I had to create the Routes.php file manually for some reason, even though I created my migrations and did:
artisan migrate
The views directory I created called 'testview' is being completely ignored in the routes file when calling:
Route::get('/', 'TestController#index');
Controller code:
Return view('testview.index');
That is within the public function index() just for those who try to be smart and say "oh but you didn't have it contained within a method".
Please could someone help and tell me where I'm going wrong??
It seems that for some reason the version of laravel on GIT is out of date as I peformed a different command line action using Composer and that installed the latest version. So in closing I've sorted this out myself, thanks.

bootstrap.php.cache is missing

I have a problem with Symfony 2. trying the example from the book. I have written a controller but when i go to the URL specified in the route i get an error. The server can't find the page. When i run app_dev.php i get an error that the file boostrap.php.cache is missing.
searched on the internet but found nothing relevant so far. I don't know if the front-controller is already written or if that is something that still has to be done by me.
I can't get the application to run.
Found the solution. I followed the guidelines installing sf2 in netbeans. Instead of running the application as a local website i used the build-in server option wich gave me access to the cli commands. There i could use the command run server and all of my problems were gone.

Categories