title: problem displaying blade file getting error '' count(): Parameter must be an array or an object that implements Countable ''
body: <p>I am having issues returning the view on my website i keep getting this error</p>
  <pre><code>ErrorException
  count(): Parameter must be an array or an object that implements Countable (View: C:\xampp\htdocs\cargo\resources\views\shipment\single.blade.php)
  </code></pre>
  <p>and this error points to a section in my blade file which is causing it, below is my blade file for the view</p>
  <pre><code> &lt;div class=&quot;card&quot; &gt;
      &lt;div class=&quot;card-body &quot;&gt;
          @if(count($shipment) &gt;0)
         @foreach($shipment as $shipment)
  
                  &lt;div class=&quot;shipment-number&quot;&gt;
          &lt;span class=&quot;title&quot; style=&quot;display: block; font-size: 25px!important;&quot;&gt;{{$shipment-&gt;tracking_code }}&lt;/span&gt;
      &lt;/div&gt;&lt;!-- Track_Num --&gt;
  &lt;/div&gt;
  &lt;br&gt;&lt;br&gt;
  
  &lt;div id=&quot;shipper-info&quot; class=&quot;row&quot; &gt;
          &lt;div class=&quot;col-md-6 detail-section&quot;&gt;
              &lt;p class=&quot;shipper details&quot;&gt;&lt;strong&gt;Shipper's Information&lt;/strong&gt;&lt;/p&gt;
              &lt;div class=&quot;shipper details&quot;&gt;
              &lt;p&gt;&lt;span class=&quot;label&quot;&gt;Shipper Name : &lt;/span&gt;{{$shipment-&gt;sender_name }}&lt;/p&gt;
              &lt;p&gt;&lt;span class=&quot;label&quot;&gt;Phone Number : &lt;/span&gt;{{$shipment-&gt;telephone }}&lt;/p&gt;
              &lt;p&gt;&lt;span class=&quot;label&quot;&gt;Email : &lt;/span&gt;{{$shipment-&gt;sender_email }}&lt;/p&gt;
              &lt;p&gt;&lt;span class=&quot;label&quot;&gt;Address : &lt;/span&gt;{{$shipment-&gt;sender_address }}&lt;/p&gt;            
          &lt;/div&gt;
      &lt;/div&gt;
              &lt;div class=&quot;col-md-6 detail-section&quot;&gt;
              &lt;p class=&quot;shipper details&quot;&gt;&lt;strong&gt;Receiver's Information&lt;/strong&gt;&lt;/p&gt;
              &lt;div class=&quot;receiver details&quot;&gt;
              &lt;p&gt;&lt;span class=&quot;label&quot;&gt;Receiver Name : &lt;/span&gt;{{$shipment-&gt;receiver_name }}&lt;/p&gt;
              &lt;p&gt;&lt;span class=&quot;label&quot;&gt;Phone Number : &lt;/span&gt;{{$shipment-&gt;receiver_telephone }}&lt;/p&gt;
              &lt;p&gt;&lt;span class=&quot;label&quot;&gt;Address : &lt;/span&gt;{{$shipment-&gt;receiver_address }}&lt;/p&gt;
              &lt;p&gt;&lt;span class=&quot;label&quot;&gt;Email : &lt;/span&gt;{{$shipment-&gt;receiver_email }}&lt;/p&gt;        
          &lt;/div&gt;
      &lt;/div&gt;
          &lt;div class=&quot;clear-line&quot;&gt;&lt;/div&gt;
  &lt;/div&gt;
  @endforeach
  @esle
  @endif
  </code></pre>
  <p>and the error points to this section</p>
  <pre><code>@if(count($shipment) &gt;0)
         @foreach($shipment as $shipment)
  </code></pre>
  <p>here is my controller</p>
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use Illuminate\Support\Str;
  use App\Shipment;
  use Illuminate\Foundation\Auth\RegistersUsers;
  use Illuminate\Support\Facades\Hash;
  use Illuminate\Support\Facades\Validator;
  use App\Http\Controllers\Controller;
  use Illuminate\Support\Facades\DB;
  use Illuminate\Support\MessageBag;
  use Illuminate\Support\Facades\Gate;
  
  
  
  
  class ShipmentController extends Controller
  {
     
      /**
       * Create a new user instance after a valid registration.
       *
       * @param  Request  $request
       * @return \App\Shipment
       */
      protected function store(Request $request)
      {
          
          $shipment = new Shipment();
  
          $data  = $this-&gt;validate($request, [
              'sender_name' =&gt; 'required|string|max:255',
              'sender_email' =&gt; 'required|string|email|max:255',
              'receiver_email' =&gt; 'required|string|email|max:255',
              'sender_address' =&gt; 'required|string',
              'estimated_Date' =&gt; 'required||date|after:today',
              'shipment_type' =&gt; 'required|string|max:255',
              'content' =&gt; 'required|string|max:255', 
              'receiver_name' =&gt; 'required|string|max:255', 
              'receiver_address' =&gt; 'required|string|max:255', 
              'sender_country' =&gt; 'required|string|max:255', 
              'sender_telephone' =&gt; 'required|string|max:255',
              'comments' =&gt; 'required|string|max:255',
              'receiver_telephone' =&gt; 'required|string|max:255',
              'receiver_country' =&gt; 'required|string|max:255',
              'package_weight' =&gt; 'required|string|max:255',
              
          ]);
          
  
          $shipment-&gt;sender_name = $request-&gt;input('sender_name');
          $shipment-&gt;receiver_email= $request-&gt;input('receiver_email');
          $shipment-&gt;sender_email= $request-&gt;input('sender_email');
          $shipment-&gt;sender_address= $request-&gt;input('sender_address');
          $shipment-&gt;estimated_Date= $request-&gt;input('estimated_Date');
          $shipment-&gt;shipment_type= $request-&gt;input('shipment_type');
          $shipment-&gt;content= $request-&gt;input('content');
          $shipment-&gt;receiver_name= $request-&gt;input('receiver_name');
          $shipment-&gt;receiver_address= $request-&gt;input('receiver_address');
          $shipment-&gt;sender_country= $request-&gt;input('sender_country');
          $shipment-&gt;sender_telephone= $request-&gt;input('sender_telephone');
          $shipment-&gt;comments= $request-&gt;input('comments');
          $shipment-&gt;receiver_telephone= $request-&gt;input('receiver_telephone');
          $shipment-&gt;receiver_country= $request-&gt;input('receiver_country');
          $shipment-&gt;package_weight= $request-&gt;input('package_weight');
          $shipment-&gt;tracking_code = strtoupper(Str::random(20));
          
          $shipment-&gt;save();   
  
             
              return redirect('/index')-&gt;with('Success', 'Your Shipment has been created');
         
      }
  
      public function tracking(Request $request){
  
          $this-&gt;validate($request,
              [
                  'tracking_code' =&gt; 'required|max:25',
  
              ]);
  
          $shipment = Shipment::where('tracking_code', $request-&gt;input('tracking_code'))-&gt;first();
          
          if ( $shipment == null)
          {
              
              return redirect('/shipment/track')-&gt;with('error', 'Incorect Tracking Number');
              
          }
          else{
              return view('shipment.single')-&gt;with('shipment', $shipment);
          }
  
      }
  
  
  
      public function view(Shipment $shipment){
  
          $page_title = &quot;view shipment&quot;;
          
  
         
          if (Gate::allows('isAdmin')) {
             return view('shipment.single',compact('shipment'. title));
      }
              
      else {
          return redirect('/home')-&gt;with('error', 'Unauthorized Page');
      }
  </code></pre>
  <p>and my routes</p>
  <pre><code>Route::Post('/tracking', 'ShipmentController@tracking')-&gt;name('tacking');
  Route::get('/shipment/view/{shipment}', 'ShipmentController@view')-&gt;name('shipment.view');
  </code></pre>
  <p>i cant get around this and have been on it for a while now , any help will be appriciated, i would like for the view to be shown along with all the data parsed for both the input(tracking function) and the single blade (view function)</p>