companyInfoAuth.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2019/4/30
  6. * Time: 13:48
  7. */
  8. namespace App\Http\Middleware;
  9. use App\Models\Tpl;
  10. use App\Repositories\MemberSetmealRepository;
  11. use App\Repositories\PmsRepository;
  12. use Closure;
  13. use Illuminate\Support\Facades\View;
  14. class companyInfoAuth
  15. {
  16. protected $memberSetmealRepositorywhere;
  17. /**
  18. * companyInfoAuth constructor.
  19. * @param $memberSetmealRepositorywhere
  20. */
  21. public function __construct(MemberSetmealRepository $memberSetmealRepository)
  22. {
  23. $this->memberSetmealRepository = $memberSetmealRepository;
  24. }
  25. public function handle($request, Closure $next)
  26. {
  27. $template = false;
  28. $companyInfo = auth('web-company')->user();
  29. if (!$companyInfo->nature || !$companyInfo->scale || !$companyInfo->organization_code || !$companyInfo->district || !$companyInfo->trade || !$companyInfo->contents) {
  30. return redirect()->route('com.info')->with('message', "请完善企业基本信息后,再进行其他操作");
  31. }
  32. $tpl = Tpl::where(['tpl_type'=>1,'display'=>1])->get();
  33. if(!$tpl->isEmpty()){
  34. $template = true;
  35. }
  36. $GLOBALS['template'] = $tpl;
  37. View::share('template', $template);
  38. return $next($request);
  39. }
  40. }