Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
632
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. public function verify() {
  2. $username = Input::get('username');
  3. $password = Input::get('password');
  4. if (!Admin::count()) {
  5. $user = new Admin;
  6. $user->username = Input::get('username');
  7. $user->password = $user->password = Hash::make(Input::get('password'));
  8. $user->save();
  9. return Redirect::to('/admin/login');
  10. } else {
  11.  
  12. if (Auth::attempt(array('username' => $username, 'password' => $password))) {
  13. echo("i m in if");
  14. if (Session::has('pre_admin_login_url')) {
  15. $url = Session::get('pre_admin_login_url');
  16. Session::forget('pre_admin_login_url');
  17. return Redirect::to($url);
  18. } else {
  19. $admin = Admin::where('username', 'like', '%' . $username . '%')->first();
  20. Session::put('admin_id', $admin->id);
  21. return Redirect::to('/admin/report')->with('notify', 'installation Notification');
  22. }
  23. } else {
  24. return Redirect::to('/admin/login?error=1');
  25. }
  26. }
  27.  
  28. use UserTrait, RemindableTrait;
  29.  
  30. /**
  31. * The database table used by the model.
  32. *
  33. * @var string
  34. */
  35. protected $table = 'admin';
  36.  
  37. /**
  38. * The attributes excluded from the model's JSON form.
  39. *
  40. * @var array
  41. */
  42. protected $hidden = array('password', 'remember_token');'
  43.  
  44. Result:SQLSTATE[HY000]: General error: 1364 Field 'remember_token' doesn't have a default value (SQL: insert into `admin` (`username`, `password`, `updated_at`, `created_at`)values(admin@taxinow.com,y$csyEcrhERoQEszmxNmiOG.bcAZtwC8xeGiF2xyKTd2YLhEbjixm.m,2017-09-21 08:34:24, 2017-09-21 08:34:24))Any help would be appreciated. Thanks.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement