I have this query
$sales = Sales::join('customer', 'customer.id', '=', 'sales.customer_id')
->join('cashier', 'cashier.id', '=', 'sales.cashier_id')
->first();
how can i select each table with prefix so i can call like this :
- $order->customer_name
- $order->cashier_name
with my query above, i only get one name row because each table have same column name name
, what
i want is to give prefixed in each table i call like customer_
, cashier_
, sales_
Update
the result what i expect is like this
customer_name
customer_address
customer_phone
cashier_name
cashier_another_column
cashier_another_column2
sales_date
sales_another_column
sales_another_column2