title: laravel 8 array sorting issue
body: <p>here i am getting data from 3 models banner , banner types and its positions (there is no issue with banner type model so i am skipping it )[the admin template is generated from quickadminpanel ]</p>
  <p>my data structure looks like</p>
  <p>banner</p>
  <pre><code>Schema::create('banners', function (Blueprint $table) {
              $table-&gt;bigIncrements('id');
              $table-&gt;string('banner_name')-&gt;unique();
              $table-&gt;string('banner_header');
              $table-&gt;string('banner_caption')-&gt;nullable();
              $table-&gt;string('banner_btn_txt');
              $table-&gt;string('banner_btn_link');
              $table-&gt;string('banner_btn_color');
              $table-&gt;timestamps();
              $table-&gt;softDeletes();
          });
  </code></pre>
  <p>2021_01_15_000003_create_positions_table.php</p>
  <pre><code>Schema::create('positions', function (Blueprint $table) {
              $table-&gt;bigIncrements('id');
              $table-&gt;string('position');
              $table-&gt;timestamps();
          });
  </code></pre>
  <p>2021_01_15_000019_add_relationship_fields_to_positions_table.php</p>
  <pre><code>Schema::table('positions', function (Blueprint $table) {
              $table-&gt;unsignedBigInteger('banner_id')-&gt;nullable();
              $table-&gt;foreign('banner_id', 'banner_fk_2983258')-&gt;references('id')-&gt;on('banners');
          });
  </code></pre>
  <pre><code>$banner = Banner::get();
  $banner_types = BannerType::get();
  $positions = Position::with(['banner'])-&gt;orderBy(&quot;position&quot;)-&gt;get();
  $banner_array = array();
  $banner_no_position = array();
  foreach ($banner as $banner){
       if(Position::where('banner_id',$banner-&gt;id)-&gt;count() != 0){
              $banner_array = array($banner);
       }else{
              // print_r($banner);
              $banner_no_position = array($banner);
       }
  }
  </code></pre>
  <p>what i am trying to do is separating the banners which has positioned and which has not positioned by creating 2 different arrays
  the one called <code>$banner_array</code> is working smoothly but the other <code>$banner_no_position</code> is just showing the last object and discarding the other objects</p>
  <p>for example i have created 4 banners and i have positioned just 2 then i get 2 objects in <code>$banner_array</code> and only 1 object in  <code>$banner_no_position</code> array but it should have 2 or more array since i have not positioned 2 banners</p>
  <p>my blade looks like the <a href="https://pastebin.com/hwAqjZ7S" rel="nofollow noreferrer">https://pastebin.com/hwAqjZ7S</a> and my complete controller looks like <a href="https://pastebin.com/LvvLPSNP" rel="nofollow noreferrer">https://pastebin.com/LvvLPSNP</a> its bit messy but i will beautify few functions later
  The functions i am using from controllers are index and newPosition to read and to save data resp</p>
  <p>banner model looks like <a href="https://pastebin.com/75nCdBvh" rel="nofollow noreferrer">https://pastebin.com/75nCdBvh</a>
  and position model looks like <a href="https://pastebin.com/vr7GPd8A" rel="nofollow noreferrer">https://pastebin.com/vr7GPd8A</a></p>