Yajra Datatable with relationship

Posted 4 months ago by fredemagi

I'm trying to facilitate databables from Yajra, but I'm not sure how to use it, and the official documentation is a bit odd in my opinion: https://yajrabox.com/docs/laravel-datatables/master/relationships

I have to two models, one being Order and one being User.

An order belongs to a user who is the customer and another who is employee. They are connected like this:

public function customer()
    {
        return $this->belongsTo(User::class, 'user_customer_id', 'id');
    }


public function employee()
    {
        return $this->belongsTo(User::class, 'user_employee_id', 'id');
    }

Where do I go from here? :/

Please sign in or create an account to participate in this conversation.