You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
580 B

  1. <?php
  2. namespace App\Utilities\Middlewares;
  3. use Closure;
  4. class BindBusinessInfo
  5. {
  6. public function handle($request, Closure $next, $guard = null)
  7. {
  8. $business_id = $request->has('business_id') ? $request->business_id : $request->route('business');
  9. $businessInfo = env('CONTAINER_NAME') == 'hi-user-app' ?
  10. \App\Business::info($business_id) :
  11. get('user', env('USER_URL') . 'actions/businesses/' . $business_id . '/info', []);
  12. $request->merge(['_business_info' => $businessInfo]);
  13. return $next($request);
  14. }
  15. }