示例#1
0
 /**
  * Returns a new grid instance of all users.
  *
  * @return \Cartalyst\DataGrid\DataGrid
  */
 public function grid()
 {
     $columns = ['id', 'first_name', 'last_name', 'email', 'created_at'];
     $settings = ['sort' => 'created_at', 'direction' => 'desc', 'threshold' => 10, 'throttle' => 11];
     $transformer = function (User $user) {
         return ['id' => $user->id, 'first_name' => $user->first_name, 'last_name' => $user->last_name, 'email' => $user->email, 'created_at' => $user->created_at->format('Y-m-d g:i a'), 'view_url' => route('maintenance.admin.users.show', [$user->id])];
     };
     return $this->user->grid($columns, $settings, $transformer);
 }
示例#2
0
 /**
  * Deletes the user with the specified ID.
  *
  * @param int|string $id
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function destroy($id)
 {
     $user = $this->user->model()->findOrFail($id);
     if ($user->delete()) {
         $message = 'Successfully deleted user.';
         return redirect()->route('maintenance.admin.users.index')->withSuccess($message);
     } else {
         $message = 'There was an issue deleting this user. Please try again.';
         return redirect()->route('maintenance.admin.users.show', [$id])->withErrors($message);
     }
 }
 /**
  * @param $view
  *
  * @return mixed
  */
 public function compose(View $view)
 {
     $users = $this->user->all()->lists('full_name', 'id')->toArray();
     return $view->with('allUsers', $users);
 }
 /**
  * @param $view
  *
  * @return mixed
  */
 public function compose(View $view)
 {
     return $view->with('users', $this->user->all()->count())->with('assets', $this->asset->all()->count())->with('inventories', $this->inventory->all()->count())->with('workOrders', $this->workOrder->all()->count());
 }