SHARE
TWEET

Users list

a guest Apr 21st, 2019 124 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Sa web.php
  2.  
  3. Route::get('get-users', 'AdminController@showUsers')->name('get-users');
  4.  
  5. // Sa controller mo
  6.  
  7. public function showUsers(){
  8.    $users = User::where('is_superadmin', 0)->orderBy('created_at', 'DESC')->get();
  9.  
  10.    return view('users')->with(['users' => $users]);
  11. }
  12.  
  13.  
  14. // Sa blade mo
  15.  
  16. @if(isset($users) && count($users) > 0)
  17. <table class="table table-bordered">
  18.     <thead>
  19.         <tr>
  20.             <th>#</th>
  21.            <th>Name</th>
  22.             <th>Email</th>
  23.             <th>Added At</th>
  24.         </tr>
  25.     </thead>
  26.     <tbody>
  27.         @php $i = 1 @endphp
  28.         @foreach($users as $user)
  29.         <tr>
  30.             <td>{{ $i++ }}</td>
  31.             <td>{{ $user->name }}</td>
  32.             <td>{{ $user->email }}</td>
  33.             <td>{{ date('M j, Y g:i A', strtotime($user->created_at ))}}</td>
  34.         </tr>
  35.         @endforeach
  36.     </tbody>
  37. </table>
  38. @endif
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top