app/Http/Controllers/LelangController.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->validate($request,[
            'id_barang' => 'required'
        ]);
        $lelang = new Lelang;
        $lelang->id_barang = $request->id_barang;
        $lelang->id_petugas = \Auth::user()->petugas->id;
        $lelang->id_masyarakat = null;
        $lelang->harga_akhir = 0;
        $lelang->status = 'dibuka';
        if($lelang->save()){
            return redirect()->route('lelang.index')->with('success','Lelang berhasil ditambahkan');
        }
        return redirect()->route('lelang.index')->with('error','Lelang gagal ditambahkan');
    }
public function store ( Request $ request ) { $ this -> validate ( $ request , [ 'id_barang' => 'required' ] ) ; $ lelang = new Lelang ; $ lelang -> id_barang = $ request -> id_barang ; $ lelang -> id_petugas = \ Auth :: user ( ) -> petugas -> id ; $ lelang -> id_masyarakat = null ; $ lelang -> harga_akhir = 0 ; $ lelang -> status = 'dibuka' ; if ( $ lelang -> save ( ) ) { return redirect ( ) -> route ( 'lelang.index' ) -> with ( 'success' , 'Lelang berhasil ditambahkan' ) ; } return redirect ( ) -> route ( 'lelang.index' ) -> with ( 'error' , 'Lelang gagal ditambahkan' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .