Laravel Scout import existing data don't work - laravel

there,
I installed Laravel Scout. If I now create a new record it will be imported correctly into Algolia. Editing and deleting also works.
But now I want to import all existing organizations.
When I run the command:
$ php artisan scout:import "App\Models\Organisation\Organisation"
All [App\Models\Organisation\Organisation] records have been imported.
However, no organizations are written to the index. Do I still have to specify anything somewhere?

did you set 'driver' => env('SCOUT_DRIVER', 'algolia'), in published scout.php file ?
tips : try meilisearch , has a good doc than algolia

Related

cannot access Component controller variables inside the component view

I have been running into this very weird issue with Laravel.
I had a problem where one of my component views was not able to read the variables defined in its class. It was kind of strange because I have several components running in my project and they all worked fine, except for this one.
So I created a fresh Laravel project to test some things out (Wanted to check if the problem was on my end, maybe I somehow messed up the project files).
I created a new component on a blank project using php artisan make:component top_nav
pre function basically is used as print_r which is in helper.php
Then I simply added a sql_data variable to the class component like so:
i tried many thing as much as i can do but still i can't access that variable
also clear cache of view
of laravel
change name of components but still can't work
kindly help me..........
you should
return view('components.top_nav', ['sql_data' => $sql_data]);
you are not passing the variable to the view
composer install
npm install && npm run dev
php artisan optimize
I just copied your screenshots into a new laravel installation and ran it with no problems.
Try setting the public property with a default value:
public $sql_data = 'testing'
If you try the above and still have issues, I'd like to confirm the output of AdminLogin::all().
PS:
TopNav instead of top_nav Class name please.

When and how do Laravel daily logging files get deleted?

I'm running Laravel 5.8 and using the built-in Laravel Log functionality. And I've created a few custom logs.
I set each of them to store the daily log files for 30 days, like so:
'reconciliation' => [
'driver' => 'daily',
'path' => storage_path('logs/reconciliation/reconciliation.log'),
'days' => 30
]
However, the logs don't stay for 30 days, like I've set them to. They stay for 7.
I've heard that there is another configuration called log_max_files, which might be what I'm looking for.
But all the references to log_max_files are from Laravel 5.4 and below. And I know that the logging functionality was revamped in 5.6. So I'm not sure if log_max_files even works anymore and I'd like to test it.
I've created a new log file with a date far outside the current 7-day range and I want to confirm that it gets deleted when the logs get cleared.
I'm just not sure when Laravel clears out the old logs. I couldn't find any in-depth information like that in the docs and my Google searching hasn't turned anything up.
I've tried restarting my server, running php artisan config:clear and php artisan cache:clear with no luck.
Does anyone actually know the process by which these log files get deleted and when that process runs?

Laravel Scout Elastic Search - Index not found

I am facing a weird issue with elasticsearch.
I am working on a Laravel project and need to integrate elastic search with it.
I am using https://github.com/babenkoivan/scout-elasticsearch-driver along with Laravel Scout.
Initially everything worked fine and I was also able to search. When it worked fine, I wanted to drop my index and reindex everything from scratch. But after that when I ran my seeder, I got an "Index not found exception". Then to test it I created index and type. eg: TestIndex/department
After that the seeder ran fine and I didn't get the "index not found exception". However, it didn't use the index which I created. It created a new index of the form "TestIndex_write/department"
Can someone please explain what am I doing wrong? why is new index with a different name being created automatically?
I am using ElasticSearch > 6.0
Although 2 months past,try update index configurator :
php artisan elastic:update-index App\MyIndexConfigurator

Unable to store session in Database in laravel 5.2

I recently upgraded my application from laravel 5.1 to 5.2 version. Also I am trying to store session in Database which is currently stored in file.
I have changed .env file to include SESSION_DRIVER=database. Also I have changed session.config file to include 'driver' => env('SESSION_DRIVER', 'database') and generated required session table.
But when I tried to login to the application I am getting TokenMismatchException in VerifyCsrfToken.php line 67: If I change SESSION_DRIVER=file then application is working as expected.
But this was not the case in Laravel 5.1 version.
What is changed in Laravel 5.2 version and what steps are required to store user session in database?
I had to deal with this issue myself as well. So the initial steps are as you had already mentioned in your question.
On fresh install of laravel and verify that everything works, change the SESSION_DRIVER=file to SESSION_DRIVER=database
Run the following commands IN ORDER in your console within the directory of your app:
php artisan session:table
composer dump-autoload
php artisan migrate
(This step might be different from what you did) In your config\session.php file search for:
'driver' => env('SESSION_DRIVER', 'file'),
and change it to the following
'driver' => env('SESSION_DRIVER', 'app.database'),
Within the same config\session.php file change the encrypt configuration to true
Set your connection and table name settings appropriately
'connection' => 'database_name_here',
'table' => 'sessions', //here you can change but sessions is recommended until you get more comfortable with how it all works
Attempt to login to your application and check your database to see if it all works.
If more help is needed you can also check a few resources that have helped me solve the issue. Keep in mind these resources are of people having similar issues but maybe your problem is similar to theirs. Only way to find out is to investigate. Hope this helps! =) :
https://laracasts.com/discuss/channels/laravel/how-to-store-users-id-in-session-table-laravel-5
https://laravel.com/docs/5.2/session
(Video tutorial on Laravel Sessions, VERY good place to help you get to where you need to be!)
https://www.youtube.com/watch?v=-FMecyZs5Cg
look it's ok to go with it manual but why don't u use the php artisan make:auth
it creates every thing u need for authentication and also helps u keeping the session instead of doing it manual ?

Laravel migration on correct DB, but data retrieve on wrong DB

I just recently put a project of mine into bitbucket as my start project. Now I cloned this project into another folder. I did the composer install command.
I created a new database for this new project and changed the variables in .env to match the new DB. When I do a 'php artisan migrate' all the tables get built in my new DB, however when I retrieve data, for example posts, it gets the posts from the other DB (used with my other project). I also checked if in the database file it was not set manually to the old DB. So I have no clue what causes this behavior.
Can anyone explain what may be the cause of this?
Thanks

Resources