app/Http/Controllers/ProvidersController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(ProviderRequest $request)
    {
        $provider = Auth()->user()->providers()->create($request->validated());
        $message = __('messages.provider_created_status');
        if(request()->wantsJson() || request()->expectsJson()) {
            return [
                'object' => $provider,
                'message' => $message
            ];
        }
        return redirect()->route('providers.index')
            ->with('status', $message);
    }
public function store ( ProviderRequest $ request ) { $ provider = Auth ( ) -> user ( ) -> providers ( ) -> create ( $ request -> validated ( ) ) ; $ message = __ ( 'messages.provider_created_status' ) ; if ( request ( ) -> wantsJson ( ) || request ( ) -> expectsJson ( ) ) { return [ 'object' => $ provider , 'message' => $ message ] ; } return redirect ( ) -> route ( 'providers.index' ) -> with ( 'status' , $ message ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .