repository = new SectionRepository(); } public function index() { $sections = $this->repository->all(); return response()->json([ 'sections' => $sections, ]); } public function store(SectionRequest $request) { $section = $this->repository->create($request->title, $request->layout); if ($section) { return response()->json([ 'message' => __('frontend::common.section-saved'), 'section' => $section, ]); } return response()->json([ 'message' => __('frontend::common.store-section-failed'), ], 400); } }