Support the ongoing development of Laravel.io →
Configuration Database Packages
Last updated 2 years ago.
0

have you tried (remove get())?:

$subscribeUser = User::where('email', $data['email']);
0

deansatch said:

have you tried (remove get())?:

$subscribeUser = User::where('email', $data['email']);

yes, still error

0

deansatch said:

have you tried (remove get())?:

$subscribeUser = User::where('email', $data['email']);

this is my model:

use Laravel\Cashier\Billable;
use Prettus\Repository\Contracts\Transformable;
use Prettus\Repository\Traits\TransformableTrait;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Auth\Authenticatable as AuthenticatableTrait;
// use Illuminate\Database\Eloquent\Model;

class User extends Authenticatable implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract
{
    use AuthenticatableTrait, Authorizable, CanResetPassword, TransformableTrait, Notifiable, Billable, SoftDeletes;

Controller:

 $user = User::create([
            'account_type' => $data['account_type'],
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
            ]);
        $subscribeUser = User::where('email', $data['email']);
        $subscribeUser->newSubscription('individual', 'individual')->create($stripeToken);

Will return

BadMethodCallException
Call to undefined method Illuminate\Database\Query\Builder::newSubscription()
0

deansatch said:

have you tried (remove get())?:

$subscribeUser = User::where('email', $data['email']);

plans are created

0
Solution

Sorry... I should have said use first() instead of get() rather than just removing it.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.