Support the ongoing development of Laravel.io →
Session Database Blade
Last updated 2 years ago.
0

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();
0

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']);

0
Solution

Well I got them like this:

    $orders = self::$user->orders()->orderBy('order_id', 'asc')->get();
    return View::make('site.users.orders', [
        'orders' => $orders
    ]);
0

Sign in to participate in this thread!

Eventy

Your banner here too?

vinsbg vinsbg Joined 26 Aug 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.