Monday, March 13, 2017

Little bit of Javascript in Laravel 5.4

First of all, I barely can code any Javascript, I searched on the internet like forever but can't find any solution, so the answer may be simple but I'm just not good in Javascript.

I got this code:

<select id="filtertimeline">
  <option value="all">All</option>
  <option value="reports">Reports</option>
  <option value="users">Users</option>
  <option value="payments">Payments</option>
</select>

@php $count = 0;
$length = count($events) @endphp

<ol>
  @foreach ($events as $event)
    @php $count = $count+1 @endphp
    <li> <a href="/events/"> Event  of  </a> </li>
  @endforeach
</ol>

It now shows all events, but what I like to get, is when the user selects reports from the options, $events only will show & count where $events->table = reports, same with users and payments.



via Mark

Advertisement