dimanche 5 septembre 2021

how can I read something from Laravel command into my controller

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;
    }


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3yNxbeo
via IFTTT

Aucun commentaire:

Enregistrer un commentaire