app/Http/Controllers/Member/PlanController.php
/**
     * Store a newly created resource in storage.
     *
     * @param \App\Http\Requests\StorePlanRequest $request
     * @return PlanResource
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(StorePlanRequest $request)
    {
        try {
            if (!PlansServices::uniquePlan($request)) {
                abort(
                    422,
                    "There is an existing plan with same validity and fees available . Please check the list of plans"
                );
            }
            $plan = Plan::create([
                "name" => $request->plan_label,
                "fee" => $request->plan_fee,
                "validity" => $request->plan_validity,
                "status" => 1,
            ]);
            return new PlanResource($plan);
        } catch (\Exception $exception) {
            return Helper::exceptionJSON($exception, 422, "Plan");
        }
    }
public function store ( StorePlanRequest $ request ) { try { if ( ! PlansServices :: uniquePlan ( $ request ) ) { abort ( 422 , " There is an existing plan with same validity and fees available . Please check the list of plans " ) ; } $ plan = Plan :: create ( [ " name " => $ request -> plan_label , " fee " => $ request -> plan_fee , " validity " => $ request -> plan_validity , " status " => 1 , ] ) ; return new PlanResource ( $ plan ) ; } catch ( \ Exception $ exception ) { return Helper :: exceptionJSON ( $ exception , 422 , " Plan " ) ; } }
Store a newly created resource in storage.
Store a newly created resource in storage .