I keep getting this error when I pass a user(venue) object through a controller into my view, I've tried encoding it, and decoding it to no avail. I've also tried finding the user in the view instead of in the controller by just passing the id of the user through, but I get the same error? People in other questions seem to have no problem doing it with this syntax or similar, am I doing something wrong?
htmlspecialchars() expects parameter 1 to be string, object given
Controller:
public function index($venue)
{
$venue = \App\venue::findOrFail($venue);
return view('index.venue')->with(['venue'=>$venue]);
}
I'm trying to access it in views like this:
<div class="venueName">
<h4>{{ $venue->name }}</h4>
</div>
<p>{{ $venue->addresse }}</p>
<p>{{ $venue->bio }}</p>
<img src="{{ url($venue->galleryOne) }}" alt="">
@foreach ($venue->item as $item)...
this is the dd($venue):
venue {#247 ▼
#guard: "venue"
#fillable: array:5 [▶]
#hidden: array:2 [▶]
#connection: "mysql"
#table: "venues"
#primaryKey: "id"
#keyType: "int"
+incrementing: true
#with: []
#withCount: []
#perPage: 15
+exists: true
+wasRecentlyCreated: false
#attributes: array:11 [▶]
#original: array:11 [▶]
#changes: []
#casts: []
#dates: []
#dateFormat: null
#appends: []
#dispatchesEvents: []
#observables: []
#relations: []
#touches: []
+timestamps: true
#visible: []
#guarded: array:1 [▶]
#rememberTokenName: "remember_token"
}
Any Help would be fantastic! Thankyou :)
dd($venue);in the index function, at start{{$venue}}?galleryOneproperty is it a string or an object?