vendredi 28 juin 2019

Laravel : Property [name] does not exist on this collection instance

i'm trying to fetch some data from my users table, for my profile page. But when i click the profile page it give me some error :

Property [name] does not exist on this collection instance.

Where is the problem? am i do it wrong or some code missing?

User Model

protected $fillable = [
    'name', 'email', 'password', 'nim', 'phone_number', 'department'
];

protected $hidden = [
    'password', 'remember_token',
];

public function dropcv(){
    return $this->hasMany('App\Dropcv');
}

public function registration(){
    return $this->hasMany('App\Registration');
}

Controller

public function index()
{
    $users = User::all();
    return view('users.profile')->with('users',$users);
}

public function show($id)
{
    $users = User::find($id);
    return view('users.profile')->with('users',$users);
}

View

<h3></h3>

In the view section i'm just do some test to fetch simple data from the users table.

i'm so frustrated finding the solution for my problem. i've search and try so many solution in the web but nothing works.i'm kinda new to laravel and really appreciate some help.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Xgfoim
via IFTTT

Aucun commentaire:

Enregistrer un commentaire