/**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(DataStatisPostRequest $request)
 {
     //
     $input = $request->all();
     $data = new Data($input);
     $data->slug_data = Str::slug($request->title);
     if ($data->save()) {
         return response()->json(array('success' => TRUE));
     }
 }
Exemple #2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(DataStatisPostRequest $request, $id)
 {
     //
     $input = $request->all();
     $data = Data::find($id);
     if ($data->update($input)) {
         return response()->json(array('success' => TRUE, 'msg' => 'Data Berhasil diupdate'));
     }
 }