/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $importKind = $request->import_task ? $request->import_task->kind()->first() : PosMemberImportKind::find($request->get('kind_id')); if (!$importKind || !$importKind->is_enabled) { return response()->view('errors.404', [], 404); } if (!in_array($this->auth->user()->corp, $importKind->allow_corps)) { return response()->view('errors.403', [], 403); } return $next($request); }
public function create(Request $request) { $importKind = PosMemberImportKind::find($request->get('kind_id')); return view($importKind->create_view_path, ['title' => "{$importKind->name}任務建立", 'task' => with(new PosMemberImportTask())]); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { return view('flap.posmember.import_kind.index', ['kinds' => PosMemberImportKind::all()]); }