9 months ago

Yajra Datatable with relationship

Posted 9 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:

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.