Answer the question
In order to leave comments, you need to log in
How in Laravel 4 to sort requests intended for a group of users?
Good afternoon dear colleagues! I've been struggling with the task for a week now and I can't solve it) Please tell me how to sort applications intended for a group of users. In theory, when a verifier enters the site, he should see only those applications that are intended for him. I have a form where the user fills in the data and selects to whom this application is assigned.
Application data is stored in the database and the list of users from the select is stored in this way in the database
a:3:{i:0;s:2:"19";i:1;s:2:"20";i:2;s: 2:"23";} their id's are collected in a string. Next, I select all requests from the database and select all fields with user id, they look like this:
The controller looks like this:
public function application()
{
$user = Sentry::getUser();
$userId = $user->id;
$recipient = DB::table('posts')->lists('recipient');
$posts = Post::all();
return View::make('applications')->with(array('posts' => $posts, 'recipient' => $recipient, 'userId' => $userId));
}
@foreach ($recipient as $recent)
<?php $recentid = unserialize($recent); ?>
@foreach($recentid as $user)
@if($userId == $user)
@foreach ($posts as $post)
<div class="panel-body">ТЕЛО ЗАЯВКИ</div>
@endforeach
@endif
@endforeach
@endforeach
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question