app/Http/Controllers/User/TokoController.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)
    {
        $attr = request()->validate([
            'nama'      => 'required',
            'pemilik'   => 'required',
            'phone'     => 'required|alpha_num'
        ]);
        $attr['hash']       = date('dmy') . Str::random(8);
        $attr['pin']        = Str::random(5);
        $attr['user_id']    = userId();
        Toko::create($attr);
        session()->flash('success', 'Toko ' . request('nama') . ' atas nama pemilik ' . request('pemilik') . ' berhasil ditambahkan');
        TimeLine('Toko ' . request('nama') . ' atas nama pemilik ' . request('pemilik') . ' berhasil ditambahkan');
        return Redirect::back();
    }
public function store ( Request $ request ) { $ attr = request ( ) -> validate ( [ 'nama' => 'required' , 'pemilik' => 'required' , 'phone' => 'required|alpha_num' ] ) ; $ attr [ 'hash' ] = date ( 'dmy' ) . Str :: random ( 8 ) ; $ attr [ 'pin' ] = Str :: random ( 5 ) ; $ attr [ 'user_id' ] = userId ( ) ; Toko :: create ( $ attr ) ; session ( ) -> flash ( 'success' , 'Toko ' . request ( 'nama' ) . ' atas nama pemilik ' . request ( 'pemilik' ) . ' berhasil ditambahkan' ) ; TimeLine ( 'Toko ' . request ( 'nama' ) . ' atas nama pemilik ' . request ( 'pemilik' ) . ' berhasil ditambahkan' ) ; return Redirect :: back ( ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .