Thank you for this logically easy to follow code. It helped me learn a few caveats. I'm now struggling with getting a total order count for a select user instead the individual orders. Someone pointing me in the right direction would be much appreciated.
thanks for tutorials ,I subscribed you to follow ,Please also guide for nestedset data relation and how to query and view in laravel .Please guide for this.I not understand it.Thanks
This is not how you do it. 1. If you use Laravel, you should use eloquent & models to get the data, not implement raw sql queries. 2. You should use IDE for programming. Not Notepad++, but Sublime or vstudio 3. Also for data that hah relations you should use Eager loading.
Everything went fine until the very last step when we try to convert orders to an array. I keep getting this error "Call to a member function toArray() on array" . I don't if it is because I'm using Laravel 5.2.
This is the last part that gave me trouble: $data = DB::table('user') ->join('user_details','user_details.user_id','=','user.id') ->select('user.name', 'user.phone', 'user.id', 'user_details.email_id') ->get()->toArray(); foreach ($data as $v) { $v->orders = DB::table('orders')->where('user_id', '=', $v->id)->get()->toArray(); } echo ""; print_r($data);
sir how to this record display on view on blade template plz give foreach code plz sir plzhow to fet record of order on blade template plz sir plz sir give code