B
B
BonBon Slick2017-03-04 18:54:57
Laravel
BonBon Slick, 2017-03-04 18:54:57

Argument 1 passed to Illuminate\Auth\SessionGuard::login()?

There is a 100% error with namespaces.

use Illuminate\Foundation\Auth\User as Authenticatable; // вот это
use Illuminate\Auth\Authenticatable; 
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    use Authenticatable;

If removed:
use Illuminate\Foundation\Auth\User as Authenticatable;
// или трейт, выдает ошибку.
use Illuminate\Auth\Authenticatable;

Tried to replace:
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Auth\Authenticatable as AuthenticableTrait;

class User extends Model
{
    use AuthenticatableTrait;
...

//вернет ошибку 
BadMethodCallException
Method newSubscription does not exist.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
BonBon Slick, 2017-03-05
@BonBonSlick

The decision, as always, under the nose, is difficult to google.
When registering, after creating an instance of the class, you must return it.

protected function create(array $data)
    {
        $stripeToken = $data['stripeToken'];
        $user = User::create([
            'account_type' => $data['account_type'],
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
            ]);
        $subscribeUser = User::where('email', $data['email'])->first();
        $subscribeUser->newSubscription('individual', 'individual')->create($stripeToken);
        return $user;
    }

A
Alexander Aksentiev, 2017-03-04
@Sanasol

Well, the names are the same...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question