Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Auth::attempt($credential)
- Method Illuminate\Auth\RequestGuard::attempt does not exist
- public static function loginUser($credentials) {
- if (Auth::attempt($credentials)) {
- echo "<pre>";
- print_r('ok');
- exit;
- }
- return [];
- }
- <?php
- namespace App;
- use IlluminateSupportFacadesAuth;
- use IlluminateAuthAuthenticatable;
- use LaravelLumenAuthAuthorizable;
- use IlluminateDatabaseEloquentModel;
- use IlluminateContractsAuthAuthenticatable as AuthenticatableContract;
- use IlluminateContractsAuthAccessAuthorizable as AuthorizableContract;
- class User extends BaseModel implements AuthenticatableContract, AuthorizableContract {
- use Authenticatable,
- Authorizable;
- /**
- * modal table
- * @var type
- */
- protected $table = 'users';
- /**
- * modal primary key
- * @var type
- */
- protected $primarykey = 'id';
- /**
- * The attributes that are mass assignable.
- *
- * @var array
- */
- protected $fillable = ['full_name', 'username',
- 'email','password', 'picture'
- ];
- /**
- * The attributes excluded from the model's JSON form.
- *
- * @var array
- */
- protected $hidden = [];
- public static function saveNewUser($inputs) {
- $user = new User($inputs);
- if ($user->save()) {
- return $user;
- }
- return [];
- }
- /**
- * login user
- * @param type $credentials
- * @return type
- */
- public static function loginUser($credentials) {
- if (Auth::attempt($credentials)) {
- echo "<pre>";
- print_r('ok');
- exit;
- }
- return [];
- }
- }
Add Comment
Please, Sign In to add comment