You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have followed the steps here, here and here, to install on an existing Laravel app alongside the Nova control panel. My first error was a permissions issue, which I have resolved. But I am now seeing this error:
get_class(): Argument #1 ($object) must be of type object, null
when I attempt to login at https://mywebite.com/cp using my email and password stored in the 'users' table. The stack trace suggests an error at UserRepository.php at line 55: return call_user_func_array([$model, $method], $args); and 44:
public function findByEmail(string $email): ?UserContract
{
if (! $model = $this->model('where', 'email', $email)->first()) {
return null;
}
I have checked my User model, which seems correct:
<?php
namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
/**
* Find a user by email.
*
* @param string $email
* @return self|null
*/
public static function findByEmail($email)
{
return self::where('email', $email)->first();
}
}
Trying to log the method:
public function model($method, ...$args)
{
$model = $this->config['model'];
\Log::info('Method being called: ' . $method);
\Log::info('Model class: ' . get_class($model));
return call_user_func_array([$model, $method], $args);
}
gets an error:
get_class(): Argument #1 ($object) must be of type object, null given {"exception":"[object] (TypeError(code: 0): get_class(): Argument #1 ($object) must be of type object, null given at ...../vendor/statamic/cms/src/Auth/Eloquent/UserRepository.php:55)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have followed the steps here, here and here, to install on an existing Laravel app alongside the Nova control panel. My first error was a permissions issue, which I have resolved. But I am now seeing this error:
when I attempt to login at https://mywebite.com/cp using my email and password stored in the 'users' table. The stack trace suggests an error at UserRepository.php at line 55: return call_user_func_array([$model, $method], $args); and 44:
I have checked my User model, which seems correct:
Trying to log the method:
gets an error:
Beta Was this translation helpful? Give feedback.
All reactions