php - Laravel: In multiple links display data only with certain column values -
with checkbox input data in table values of 1. now, example, john has 25 rows value of 1, michael 15, maria 10 etc... now, create bootstrap list link on (i put in attachemnt) , want when click on michael show me table rows michael have values of 1, same john, maria etc..
i have more data in there, example, relations when login user new york displays names town_id ny, , works. names john, michael, maria don't have id-s, can't relate them, it's columns variables.
routes this:
route::resource('/statistic', 'statisticcontroller');
controller:
public function index() { $activists = activist::where('town_id', auth::user()->town_id)->get(); return view('statistic.index', compact('activists')); } public function show() { $activists = activist::where('town_id', auth::user()->town_id)->paginate(10); return view('statistic.show', compact('activists')); }
index.blade.php:
<ul class="list-group"> <a href="{{ url('statistic/show') }}" class="list-group-item"><span class="badge">{{$activists->where('work_on_computer', 1) ? $activists->where('john', 1)->count() : '0'}}</span> john</a> <a href="{{ url('statistic/show') }}" class="list-group-item"><span class="badge">{{$activists->where('sticking_posters', 1) ? $activists->where('michael', 1)->count() : '0'}}</span> michael</a> <a href="{{ url('statistic/show') }}" class="list-group-item"><span class="badge">{{$activists->where('sharing_flyers', 1) ? $activists->where('maria', 1)->count() : '0'}}</span> maria</a> </ul>
now, when click on link show me whole table can't figure out how filter john or michael or maria. sorry if confusing.
i guess confused resource routes. work -
route::resource('statistic', 'statisticcontroller'); actions handled resource controller verb uri action route name /statistic index statistic.index /statistic/create create statistic.create post /statistic store statistic.store /statistic/{id} show statistic.show /statistic/{id}/edit edit statistic.edit put/patch /statistic/{id} update statistic.update delete /statistic/{id} destroy statistic.destroy
hope figure out further action.
Comments
Post a Comment