lundi 3 décembre 2018

How to automatically update data in laravel view?

I have a view which will show the list important tasks from database. I have a function in controller which returns the collection of data to the view.

My controller function is

public function list()
{
    $tasks= Task::where('category','1')->get();
    //category is 1 when the task is important
    return view('important', compact('tasks'));
}

My view is like

<ul>    
@foreach ($tasks as $task)  
    <li> </li>
@endforeach
</ul>

What I want to essentially do is to call the list function whenever a new important task is added into the database. How can I do that?



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

Aucun commentaire:

Enregistrer un commentaire