/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Admins::create(['name' => 'Cory Cunanan', 'email' => '*****@*****.**', 'password' => bcrypt('hanspree')]);
     Admins::create(['name' => 'Gurbir Singh', 'email' => '*****@*****.**', 'password' => bcrypt('droppedmycase')]);
     Admins::create(['name' => 'Vikas Chauhan', 'email' => '*****@*****.**', 'password' => bcrypt('gobigorgohome')]);
     Admins::create(['name' => 'Mohib Jafri', 'email' => '*****@*****.**', 'password' => bcrypt('butterisntbrown')]);
 }
Exemplo n.º 2
0
 public function edit($entity)
 {
     parent::edit($entity);
     \App\Admins::creating(function ($data) {
         $data->password = Hash::make(\Request::input('password'));
     });
     $this->edit = \DataEdit::source(new \App\Admins());
     $this->edit->label('Editar Administradores');
     $this->edit->add('first_name', 'Name', 'text');
     $this->edit->add('email', 'email', 'text')->rule('required');
     $this->edit->add('password', 'Senha', 'text')->rule('required');
     return $this->returnEditView();
 }
Exemplo n.º 3
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $username = $_POST['username'];
     $password = $_POST['password'];
     $admins = Admins::all();
     foreach ($admins as $admin) {
         if ($admin->name == $username && $admin->password == $password) {
             //Flush all Session data
             \Session::flush();
             //Session starts
             \Session::put('current_user', $admin->name);
             \Session::put('user_id', $admin->id);
             return true;
         }
     }
     return false;
 }
Exemplo n.º 4
0
 public function updateEmail(Request $request)
 {
     $name = Input::get('email');
     if (isset($_COOKIE['admin_user'])) {
         $id = json_decode($_COOKIE['admin_user'], true);
         try {
             $admin = Admins::whereUser_id($id[0]['id'])->first();
             $admin->email = $name;
             $admin->save();
             $res['name'] = $name;
             return response()->json($res);
         } catch (Exception $e) {
             $this->LogError('AdminController Register_Page Function', $e);
         }
     } else {
         return redirect('/admin_panel_login');
     }
 }