Пример #1
0
 public function saveData($timeline_id, $request)
 {
     $listLanguage = AppLanguage::orderBy('language_name')->get();
     $contents = $request->input('content');
     foreach ($listLanguage as $language) {
         $timeline_details = new TimelineDetail();
         $timeline_details->timeline_id = $timeline_id;
         $timeline_details->language_code = $language->code;
         $timeline_details->content = $contents[$language->code] ? $contents[$language->code] : " ";
         $timeline_details->save();
     }
     return $timeline_id;
 }
Пример #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function delete(Request $request)
 {
     $timeline_id = $request->route('timeline');
     $affected_row = TimelineDetail::where('timeline_id', '=', $timeline_id)->delete();
     if ($affected_row) {
         $affected_row = Timeline::find($timeline_id)->delete();
         if (!$affected_row) {
             return redirect()->route('cpanel.timeline.index')->with('status', 'fail')->with('msg', 'Can not delete data.');
         } else {
             return redirect()->route('cpanel.timeline.index')->with('status', 'success')->with('msg', 'Successfully !');
         }
     } else {
         return redirect()->route('cpanel.timeline.index')->with('status', 'fail')->with('msg', 'Can not delete data.');
     }
 }