app/Http/Controllers/AdminPaidBookController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(UpdatePbookRequest $request, Pbook $pbook)
    {
        if ($request->hasFile('image')) {
          $image=$request->image->store('freebooks');
        }else {
          $image=$pbook->image;
        }
        $fbook->update([
         'name'=>strip_tags($request->name),
         'writer_name'=>strip_tags($request->writer_name),
         'category_id'=>$request->category_id,
         'price'=>$request->price,
         'description'=>strip_tags($request->description),
         'image'=>$image,
         'available'=>'1',
         'user_id'=>auth()->user()->id
        ]);
        if(Session::has('locale')==='en')
     {
          session()->flash('success','You updateed the book successfully' );
     }else {
       session()->flash('success','لقد قمت بتحديث الكتاب بنجاح');
     }
        return redirect(route('adminpbooks.index'));
    }
public function update ( UpdatePbookRequest $ request , Pbook $ pbook ) { if ( $ request -> hasFile ( 'image' ) ) { $ image = $ request -> image -> store ( 'freebooks' ) ; } else { $ image = $ pbook -> image ; } $ fbook -> update ( [ 'name' => strip_tags ( $ request -> name ) , 'writer_name' => strip_tags ( $ request -> writer_name ) , 'category_id' => $ request -> category_id , 'price' => $ request -> price , 'description' => strip_tags ( $ request -> description ) , 'image' => $ image , 'available' => '1' , 'user_id' => auth ( ) -> user ( ) -> id ] ) ; if ( Session :: has ( 'locale' ) === 'en' ) { session ( ) -> flash ( 'success' , 'You updateed the book successfully' ) ; } else { session ( ) -> flash ( 'success' , 'لقد قمت بتحديث الكتاب بنجاح'); } return redirect ( route ( 'adminpbooks.index' ) ) ; }
Update the specified resource in storage.
Update the specified resource in storage .