first: remove the user_id in the relations. It's the default key Eloquent will look for for that relation.
second:
$user_order = $this->user->id;
if you are using the built in authentication use the following to get the user
$user = Auth::user();
Thank's for the answer. Is still no data on the page but here is what I forgot to mention in my question. This is the button for orders view
<li><a href="{{ URL::to('/users/orders') }}?_token={{ csrf_token() }}">My Orders</a></li>and this is the route Route::get('/users/orders', ['uses' => 'UsersController@viewOrders', 'before' => 'auth|csrf']);
Well I got them like this:
$orders = self::$user->orders()->orderBy('order_id', 'asc')->get();
return View::make('site.users.orders', [
'orders' => $orders
]);
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community