app/Http/Controllers/AnnonceController.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 $req)
    {
        $id = Auth::user()->id;
        $entreprise = Entreprise::where('user_id' , $id)->first();
        $idEn = $entreprise->id;
        $titre = $req->input('titre');
        $detail = $req->input('detail');
        $domaine = $req->input('domaine');
        $annonce = new Annonce;
        $annonce->titre = $titre;
        $annonce->detail = $detail;
        $annonce->entreprise_id = $idEn;
        $annonce->save();
        return redirect()->route('annonce');
    }
public function store ( Request $ req ) { $ id = Auth :: user ( ) -> id ; $ entreprise = Entreprise :: where ( 'user_id' , $ id ) -> first ( ) ; $ idEn = $ entreprise -> id ; $ titre = $ req -> input ( 'titre' ) ; $ detail = $ req -> input ( 'detail' ) ; $ domaine = $ req -> input ( 'domaine' ) ; $ annonce = new Annonce ; $ annonce -> titre = $ titre ; $ annonce -> detail = $ detail ; $ annonce -> entreprise_id = $ idEn ; $ annonce -> save ( ) ; return redirect ( ) -> route ( 'annonce' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .