Answer the question
In order to leave comments, you need to log in
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;
use Illuminate\Foundation\Auth\User as Authenticatable;
// или трейт, выдает ошибку.
use Illuminate\Auth\Authenticatable;
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
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;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question