code: public function scopeFindByUser($query, $userId)
      {
          if (empty($userId)) return;
          $cart = $query->whereUser($userId)->first();
          if (empty($cart)) {
              $cart = call_user_func( Config::get('shop.cart') . '::create', [
                  'user_id' =>  $userId
              ]);
          }
          return $cart;
      }
docs: Scope to current user cart and returns class model.
  
  @param \Illuminate\Database\Eloquent\Builder $query  Query.
  
  @return this