all())->simplePaginate(); return PlanResource::collection($plans); } /** * Store a newly created resource in storage. */ public function store(CreateOrUpdateRequest $request) { $plan = new Plan(); $plan->mergeFillable([ 'company_id' ]); $plan->fill([ ...$request->all(), 'company_id' => Auth::user()->company_id, ]); $plan->save(); return $this->created(); } /** * Display the specified resource. */ public function show(string $id) { $plan = Plan::findOrFail($id); return new PlanResource($plan); } /** * Update the specified resource in storage. */ public function update(CreateOrUpdateRequest $request, string $id) { $plan = Plan::findOrFail($id); $plan->fill($request->all()); $plan->save(); return $this->noContent(); } /** * Remove the specified resource from storage. */ public function destroy(string $id) { $plan = Plan::findOrFail($id); $plan->delete(); return $this->noContent(); } }