/** * 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')]); }
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(); }
/** * 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; }
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'); } }