public static function collection($workingAreaId) { $leads = Lead::with('gcf')->where('working_area_id', $workingAreaId)->orderBy('updated_at', 'created_at')->get(); return $leads->each(function ($item, $key) { $play = Play::with('gcf')->find($item->play_id); $item->play_name = createPlayName($play->gcf->res_litho, $play->gcf->res_formation, $play->gcf->res_formation_level, $play->gcf->res_age_period, $play->gcf->res_age_epoch, $play->gcf->res_dep_env, $play->gcf->trp_type); }); }
/** * AJAX call, delete play_id yang sesuai. * * return string */ public function destroy() { $play = Play::findOrFail(request('id')); if (Gate::denies('access-play', $play)) { abort(404); } DB::transaction(function () use($play) { $play->delete_reason = request('reason'); $play->timestamps = false; $play->save(); $play->delete(); }); session()->flash('success', 'Play successfully deleted, thank you!'); return 'destroyed'; }
public function listing() { // $plays=Play::paginate(10); //return view('articles.listing')->withArticles($articles); return view('plays.listing')->withPlays(Play::take('all')->orderBy('created_at', 'desc')->paginate(5)); }
/** * Mencari detail untuk satu Play beserta data GCF. * * @param int @playId * @return \Illuminate\Support\Collection */ public static function detail($playId) { return Play::with('gcf')->findOrFail($playId); }