0

I need help on this , I want to make fetching from two or more than two models with clause and fetch selected fields in laravel 5.

    <?php
    //I was trying this but it didn't worked
    $this->users->
               with('contacts', 'orders')->
               get(array('users.id', 'contacts.phone', 'orders.price;

    ?>
Soumik Chakraborty
  • 243
  • 1
  • 2
  • 15
  • You will have to use joins. `with` loads the related data in a separate query and won't work for your problem. – Jerodev Nov 09 '17 at 14:12
  • I have used 'with' to load different model but how to get different fields from different model , because , by this way its not giving me those fields . I need a sample code which shows how to do that , also I want to make filter with some clause on the fetched column datas , how I'm going to achieve them. – Soumik Chakraborty Nov 10 '17 at 05:55

0 Answers0