mercredi 23 mars 2016

Displaying Data from an Eloquent collection with Relations

I'm trying to get data from an Eloquent query as follows:

$submission->find($id)->first()->with('user', 'clientform')->get();

I'm sending the submission to the view and attempting to access properties from the user model like so:

{{ $submission->clientform->name }}

However, Laravel is throwing the following error:

Undefined property: Illuminate\Database\Eloquent\Collection::$clientform

What am I doing wrong with the way my query is formatted?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire