jeudi 23 janvier 2020

Laravel 5 - get value from DTB

my goal is to get a value "mtime" from the database to set stopwatch in javascript.

mtime is time in seconds

DTB record Table lessons:

id | user_id | node_id | sub_id | mtime | state |
-------------------------------------------------
1  |    1    |    1    |   1    |  900  | open  |

lesson.blade.php :

<div class="silent_lesson" data-timer="">
</div>

<script type='text/javascript'>
    var mtime = parseInt('');
</script>

add values to Table lessons:

public function insertDay(Request $request) {
    $mtime = $request->mtime;
    $node_id = $request->node_id;
    $silents = Auth::user()->lessons()->where("node_id",$node_id)->where("sub_id","<>","root")->orderBy('sub_id','DESC')->get();

    return 0;
}

When I have values ​​in table lessons, how do I write a function to get a mtime value for ?

public function getMtime(Request $request)
{
    $silent_data = Auth::user()->lessons()->where(..
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire