Teren-app/app/Console/Commands/ImportPosts.php
2024-11-19 12:49:16 +01:00

26 lines
504 B
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\Post;
class ImportPosts extends Command
{
protected $signature = 'import:posts';
protected $description = 'Import posts into Algolia without clearing the index';
public function __construct()
{
parent::__construct();
}
public function handle()
{
$posts = Post::all();
$posts->searchable();
$this->info('Posts have been imported into Algolia.');
}
}