PackageLogisticController.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Filters\OrderPackageFilters;
  4. use App\Logistic;
  5. use App\OrderPackage;
  6. use App\Owner;
  7. use Illuminate\Http\Request;
  8. class PackageLogisticController extends Controller
  9. {
  10. //
  11. /**
  12. * PackageLogisticsController constructor.
  13. */
  14. public function __construct()
  15. {
  16. $this->middleware('auth');
  17. }
  18. public function index(OrderPackageFilters $filters)
  19. {
  20. $orderPackages = OrderPackage::query()->filter($filters)->with(['order' => function ($query) {
  21. $query->with(['logistic', 'owner', 'packages.commodities']);
  22. }])->orderByDesc('id')->paginate(50);
  23. // $orderPackages = OrderPackage::query()->with(['order' => function ($query) {
  24. // $query->with(['logistic','owner','packages.commodities']);
  25. // }]) ->orderByDesc('id')->paginate(50);
  26. $logistics = Logistic::all();
  27. $owners = Owner::all();
  28. return view('package.logistic.index', compact('orderPackages', 'logistics', 'owners'));
  29. }
  30. }