app/Http/Controllers/UrlController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \App\Http\Requests\UpdateUrlRequest  $request
     * @param  \App\Models\Url  $url
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(UpdateUrlRequest $request, Url $url)
    {
        $updateUrl = $request->validated();
        if (!$request->filled('custom_key')) {
            $updateUrl["custom_key"] = $this->generateRandomString();
        }
        $url->update($updateUrl);
        return redirect()->route('url.index')
            ->with('success', 'Url created successfully.')
            ->with('short_link', env('APP_SHORT_URL') . $updateUrl["custom_key"]);
    }
public function update ( UpdateUrlRequest $ request , Url $ url ) { $ updateUrl = $ request -> validated ( ) ; if ( ! $ request -> filled ( 'custom_key' ) ) { $ updateUrl [ " custom_key " ] = $ this -> generateRandomString ( ) ; } $ url -> update ( $ updateUrl ) ; return redirect ( ) -> route ( 'url.index' ) -> with ( 'success' , 'Url created successfully.' ) -> with ( 'short_link' , env ( 'APP_SHORT_URL' ) . $ updateUrl [ " custom_key " ] ) ; }
Update the specified resource in storage.
Update the specified resource in storage .