예제 #1
0
 public function store($inputs, $user_id)
 {
     $wisata = new Wisata();
     $wisata->name = $inputs['name'];
     $wisata->user_id = $user_id;
     // $wisata->user_id = 1;
     $wisata->save();
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $wisata_baru = new Wisata();
     $wisata_baru->nama = Input::get('nama');
     $wisata_baru->alamat = Input::get('alamat');
     $wisata_baru->latitude = Input::get('latitude');
     $wisata_baru->longitude = Input::get('longtitude');
     $wisata_baru->wilayah = Input::get('wilayah');
     $wisata_baru->deskripsi = Input::get('deskripsi');
     $wisata_baru->aff = Input::get('aff');
     //$input = $request->all();
     //Wisata::create($input);
     if (Input::hasFile('image')) {
         $file = Input::file('image');
         $filename = str_random(25) . '-' . $file->getClientOriginalName() . '.' . $file->getClientOriginalExtension();
         $destinationPath = 'protected/assets/images';
         $file->move($destinationPath, $filename);
         $wisata_baru->image = url('protected/assets/images') . "/" . $filename;
     }
     $wisata_baru->save();
     return redirect('admin/wisata');
 }