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