realty/app/Http/Controllers/API/v1/CompanyController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Company  $company
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, Company $company)
    {
        $this->authorize('update', $company);
        $this->validate($request, [
            'name' => [
                'string',
                'max:191',
                Rule::unique('companies')->ignore($company),
            ],
        ]);
        if ($request->has('name')) {
            $company->name = $request->name;
        }
        $company->save();
        return new CompanyResource($company);
    }
public function update ( Request $ request , Company $ company ) { $ this -> authorize ( 'update' , $ company ) ; $ this -> validate ( $ request , [ 'name' => [ 'string' , 'max:191' , Rule :: unique ( 'companies' ) -> ignore ( $ company ) , ] , ] ) ; if ( $ request -> has ( 'name' ) ) { $ company -> name = $ request -> name ; } $ company -> save ( ) ; return new CompanyResource ( $ company ) ; }
Update the specified resource in storage.
Update the specified resource in storage .