app/Http/Controllers/AdminPaidBookController.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(CreatePbookRequest $request)
    {
      $image=$request->image->store('paidbooks');
       Pbook::create([
         'name'=>$request->name,
         'writer_name'=>$request->writer_name,
         'category_id'=>$request->category_id,
         'price'=>$request->price,
         'available'=>'1',
         'description'=>strip_tags($request->description),
         'image'=>$image,
         'user_id'=>auth()->guard('admin')->user()->id
     ]);
     if ($request->has('en')) {
       session()->flash('succes','You added a new book successfully' );
  }else {
    session()->flash('succes','لقد قمت بإضافة كتاب جديد بنجاح');
  }
     return redirect(route('adminpbooks.index'));
    }
public function store ( CreatePbookRequest $ request ) { $ image = $ request -> image -> store ( 'paidbooks' ) ; Pbook :: create ( [ 'name' => $ request -> name , 'writer_name' => $ request -> writer_name , 'category_id' => $ request -> category_id , 'price' => $ request -> price , 'available' => '1' , 'description' => strip_tags ( $ request -> description ) , 'image' => $ image , 'user_id' => auth ( ) -> guard ( 'admin' ) -> user ( ) -> id ] ) ; if ( $ request -> has ( 'en' ) ) { session ( ) -> flash ( 'succes' , 'You added a new book successfully' ) ; } else { session ( ) -> flash ( 'succes' , 'لقد قمت بإضافة كتاب جديد بنجاح'); } return redirect ( route ( 'adminpbooks.index' ) ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .