app/Http/Controllers/FeatureController.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(Request $request)
    {
        $this->authorize("create", Feature::class);
        request()->validate([
            "image"=>["required"],
            "titre"=>["required"],
            "sous-titre"=>["required"],
            "description1"=>["required"],
            "description2"=>["required"],
            "description3"=>["required"]
        ]);
        $feature = new Feature();
        $feature->image = $request->image;
        $feature->titre = $request->titre;
        $feature->sous_titre = $request->sous_titre;
        $feature->description1 = $request->description1;
        $feature->description2 = $request->description2;
        $feature->description3 = $request->description3;
        $feature->save();
        return redirect('/');
    }
public function store ( Request $ request ) { $ this -> authorize ( " create " , Feature :: class ) ; request ( ) -> validate ( [ " image " => [ " required " ] , " titre " => [ " required " ] , " sous-titre " => [ " required " ] , " description1 " => [ " required " ] , " description2 " => [ " required " ] , " description3 " => [ " required " ] ] ) ; $ feature = new Feature ( ) ; $ feature -> image = $ request -> image ; $ feature -> titre = $ request -> titre ; $ feature -> sous_titre = $ request -> sous_titre ; $ feature -> description1 = $ request -> description1 ; $ feature -> description2 = $ request -> description2 ; $ feature -> description3 = $ request -> description3 ; $ feature -> save ( ) ; return redirect ( '/' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .