Guest User

Untitled

a guest
May 28th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. Auth::attempt($credential)
  2.  
  3. Method Illuminate\Auth\RequestGuard::attempt does not exist
  4.  
  5. public static function loginUser($credentials) {
  6. if (Auth::attempt($credentials)) {
  7. echo "<pre>";
  8. print_r('ok');
  9. exit;
  10. }
  11. return [];
  12. }
  13.  
  14. <?php
  15.  
  16. namespace App;
  17.  
  18. use IlluminateSupportFacadesAuth;
  19. use IlluminateAuthAuthenticatable;
  20. use LaravelLumenAuthAuthorizable;
  21. use IlluminateDatabaseEloquentModel;
  22. use IlluminateContractsAuthAuthenticatable as AuthenticatableContract;
  23. use IlluminateContractsAuthAccessAuthorizable as AuthorizableContract;
  24.  
  25. class User extends BaseModel implements AuthenticatableContract, AuthorizableContract {
  26.  
  27. use Authenticatable,
  28. Authorizable;
  29.  
  30. /**
  31. * modal table
  32. * @var type
  33. */
  34. protected $table = 'users';
  35.  
  36. /**
  37. * modal primary key
  38. * @var type
  39. */
  40. protected $primarykey = 'id';
  41.  
  42. /**
  43. * The attributes that are mass assignable.
  44. *
  45. * @var array
  46. */
  47. protected $fillable = ['full_name', 'username',
  48. 'email','password', 'picture'
  49. ];
  50.  
  51. /**
  52. * The attributes excluded from the model's JSON form.
  53. *
  54. * @var array
  55. */
  56. protected $hidden = [];
  57.  
  58.  
  59. public static function saveNewUser($inputs) {
  60. $user = new User($inputs);
  61. if ($user->save()) {
  62. return $user;
  63. }
  64. return [];
  65. }
  66.  
  67.  
  68. /**
  69. * login user
  70. * @param type $credentials
  71. * @return type
  72. */
  73. public static function loginUser($credentials) {
  74. if (Auth::attempt($credentials)) {
  75. echo "<pre>";
  76. print_r('ok');
  77. exit;
  78. }
  79. return [];
  80. }
  81.  
  82. }
Add Comment
Please, Sign In to add comment