I thought there was a problem with the description of index.blade.php as shown in the error statement, so I checked the file, but I couldn't find the description about getAuthIdentifierName(), so I didn't know what was causing the error, and I couldn't even isolate the problem.I would appreciate it if someone could reply.Also, please let me know if you have any files or environments to suggest for resolution.
Error Statements
Call to undefined method App\User::getAuthIdentifierName() (View:
/Users/★★/projects/original/resources/views/originals/index.blade.php)
index.blade.php
@extends('layout')
@section('content')
<div class="contents row">
@foreach ($original as $original)
<div class="content_post" style="background-image:url(images/{{$original->image}});">
@if(Auth::check()&Auth::user()->id==$original->user_id)
<div class="more">
<span><img src="{asset('images/anonymous-250.jpg')}}">/span>
<ul class="more_list">
<li><a href="/original/{{$original->id}}/edit">Edit<<a></li>;
<li><a href="/original/{{$original->id}}/delete">Delete<a></li>;
</ul>
</div>
@endif
<p>{{$original->text}}</p>
<span class="name">
<a href="/users/{{$original->user_id}}">
</a>
</span>
</div>
{{ $originals ->links()}}
@endforeach
</div>
@endsection
user.php(app)
<?php
namespace App;
use Illuminate\Notifications\Notify;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Database\Eloquent\Model;
class User extensions Model
{
use Notify;
/**
* The attributes that are pass assignable.
*
* @var array
*/
protected$fillable=[
'name', 'email', 'password', 'avatar',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
public function originals()
{
return $this->hasMany (Original::class);
}
}
Environment
Lavel Framework 5.7.19
PHP 7.1.19 (cli) (build: Aug 17 2018 20:10:18) (NTS)
macOS Mojave 10.14.2 (18C54)
use Illuminate\Auth\Authenticatable;
use Illuminate\Contracts\Auth\Authenticatable as UserContract;
use Illuminate\Database\Eloquent\Model;
class User extensions Model implements UserContract
{
use Authenticatable;
}
is the most desirable form. The theory is to minimize extends
and cover where you can go with implementations
+use
.
class User extensions Model
Once class User extensions are authenticated,
The error has been resolved.
© 2024 OneMinuteCode. All rights reserved.