function parseAt($comment) { $atUsers = []; preg_match_all("/(\\S*)\\@([^\r\n\\s]*)/i", $comment, $atUsers); $usernames = []; foreach ($atUsers[2] as $k => $v) { if ($atUsers[1][$k] || strlen($v) > 25) { continue; } $usernames[] = $v; } $usernames = array_unique($usernames); if (count($usernames)) { $users = App\User::whereIn('name', $usernames)->get(); if ($users) { foreach ($users as $user) { $search = '@' . $user->name; // $place = '<a href="'.route('user.show', $user->id).'" target="_blank" title="'.$user->name.'" data-toggle="tooltip">'.$search.'</a>'; $place = '[' . $search . '](' . route('user.show', $user->id) . ' "' . $user->name . '")'; $comment = str_replace($search, $place, $comment); } } } return $comment; }
<h3 class="profile-username text-center">{{$attendance->name}}</h3> <p class="text-muted text-center">{{$attendance->date}}</p> <p class="text-muted text-center">Attended Members</p> <ul class="list-group list-group-unbordered"> <?php $attended_users_ids = $attendance->attendance_users()->where("attended", "=", 1)->get()->lists("user_id"); ?> <?php $absent_users_ids = $attendance->attendance_users()->where("attended", "=", 0)->get()->lists("user_id"); ?> <?php $absent_users = App\User::whereIn("id", $absent_users_ids)->get(); ?> <?php $attended_users = App\User::whereIn("id", $attended_users_ids)->get(); ?> <?php $attended_members = $attended_users->filter(function ($item) { return $item->member_type == 0; }); $absent_members = $absent_users->filter(function ($item) { return $item->member_type == 0; }); $attended_new_comers = $attended_users->filter(function ($item) { return $item->member_type == 1; }); $absent_new_comers = $absent_users->filter(function ($item) { return $item->member_type == 1; }); $attended_non_members = $attended_users->filter(function ($item) {