Beispiel #1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show()
 {
     if (Auth::check()) {
         $id = Auth::user()->id;
         $user = User::find($id);
         if ($user->is('admin')) {
             return view('teachers.thshownotas');
         } else {
             $users = DB::table('users')->join('grades', 'users.id', '=', 'grades.user_id')->select('users.firstname', 'grades.unit', 'grades.notas_especificas', 'grades.cod_class')->where('users.id', '=', $id)->get();
             return view('user.shownotas', compact('users'));
         }
     }
 }
Beispiel #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(LoginRequest $request)
 {
     if (Auth::attempt(['username' => $request['username'], 'password' => $request['password']])) {
         $id = Auth::user()->id;
         $user = User::find($id);
         if ($user->is('admin')) {
             return Redirect::to('/thprofile');
         } else {
             return Redirect::to('/profile');
         }
     } else {
         Session::flash('message-error', 'Datos son Incorrectos');
         return Redirect::to('/login');
     }
 }
Beispiel #3
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show()
 {
     $users = \Notas\User::all();
     return view('login.show', compact('users'));
 }
Beispiel #4
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }
Beispiel #5
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     return User::create(['username' => $data['username'], 'password' => $data['password']]);
 }
Beispiel #6
0
 public function edit($id)
 {
     $user = User::find($id);
     return view('login.edit', ['user' => $user]);
 }