Thanks to be advised that I have created a new laravel command that runs periodically through the schedule function.
Here in the handle function, I am performing this query every day and I want to be able to retrieve the variable topics in a get method in my controller. So what is the best way to conduct this?
public function handle()
{
$topics = DB::table("sentences")
->select("topic")
->OrderByRaw("RAND()")
->distinct()
->limit(5)
->get();
echo($topics);
return 0;
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire