public function indexjson($month, $year) { $eventList1 = Events::where('e_type', 'single')->where(\DB::raw('MONTH(e_date)'), '=', $month)->where(\DB::raw('YEAR(e_date)'), '=', $year)->orWhere('e_type', 'annual')->where(\DB::raw('MONTH(e_date)'), '=', $month)->where(\DB::raw('YEAR(e_date)'), '<=', $year)->get(); $eventList2 = Events::where('e_type', '!=', 'single')->where('e_type', '!=', 'annual')->get(); $eventList = $eventList1->merge($eventList2); return response()->json($eventList); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function tampil($id) { $data = array(); $event = Events::where('id', $id)->first(); $events = Events::whereNotIn('id', array($id))->take(3)->get(); $data = array('event' => $event, 'events' => $events); return view('pages.seeevent', $data); }
public function deleteEvent(Request $request) { $post = $request->all(); $i = $post['id']; if ($i != " ") { Events::where('id', '=', $i)->delete(); return redirect('pasakumi'); } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Request $request) { $data = array(); $search = $request->input('search'); $schools = Schools::where('nama_sekolah', 'like', '%' . $search . '%')->get(); $articles = Articles::where('title', 'like', '%' . $search . '%')->where('category', 'news')->get(); $activities = Articles::where('title', 'like', '%' . $search . '%')->where('category', 'activity')->get(); $events = Events::where('title', 'like', '%' . $search . '%')->get(); $total = $schools->count() + $articles->count() + $activities->count() + $events->count(); $data = array('schools' => $schools, 'articles' => $articles, 'activities' => $activities, 'events' => $events, 'search' => $search, 'total' => $total); return view('pages.pencarian', $data); }
public function updateEvent(Request $request, $id) { $this->validate($request, ['updateEventTitle' => 'required|max:20|min:3', 'picDate' => 'required', 'updateEventDescription' => 'required|max:500|min:10']); $updateEvent = Events::where('event_id', $id)->firstOrFail(); $updateEvent->eventName = $request->updateEventTitle; $updateEvent->eventUserId = \Auth::user()->id; $updateEvent->eventLocationId = $request->updateEventLocation; $updateEvent->eventDate = $request->get('picDate'); $updateEvent->eventDescription = $request->get('updateEventDescription'); if ($request->hasFile('updateEventImage')) { $fileName = uniqid() . '.' . $request->file('updateEventImage')->getClientOriginalExtension(); \Image::make($request->file('updateEventImage'))->save('img/Event/' . $fileName); //delete the old image \File::Delete('img/Event/' . $updateEvent->eventImage); $updateEvent->eventImage = $fileName; } $updateEvent->save(); return redirect('events'); }
public function get_events($id = null) { if (\Auth::check()) { $accessor = Session::get('email'); $user = User::where('email', $accessor)->first(); if ($id == null) { $id = Session::get('email'); } if ($user->priviliges == 1 || $accessor == $id) { $events = Events::where('society_email', $id)->pluck('event_id')->toArray(); $details = []; foreach ($events as $value) { $name = EventDetails::where('event_id', $value)->pluck('event_name')->first(); array_push($details, ['id' => $value, 'name' => $name]); } return $details; } return 0; } }
public function show($id, Request $request) { $user = Auth::user(); $events = Events::where('creator', $user->id)->where('id', $id)->get(); $event_id = 0; $c = 0; while ($c++ < 1) { if (isset($events[0])) { $event_id = $events[0]->id; $events[0]->ts_start_dt = $this->dtFromTs($events[0]->ts_start); $events[0]->ts_end_dt = $this->dtFromTs($events[0]->ts_end); break; } } $guests = $this->getEventGuestStatus($event_id); return view('events.read', array('model' => 'Event', 'route' => 'events', 'command' => 'read', 'first_event_id' => $event_id, 'events' => $events, 'guests' => $guests)); }
public function indexannualfloat() { $eventList = Events::where('e_type', 'annualfloat')->orderBy('e_date')->get(); return view('annualFloatType')->with('events', $eventList); }
public function delete($tipe, $id) { if ($tipe == 'event') { Events::where('id', $id)->delete(); return redirect('dashboard/admin/events'); } elseif ($tipe == 'article') { Articles::where('id', $id)->delete(); $upload_folder = '/img/article/'; unlink(public_path() . $upload_folder . $id . '.jpg'); return redirect('dashboard/admin/articles'); } elseif ($tipe == 'user') { $role = Users::where('id', $id); Users::where('id', $id)->delete(); if ($role - role == 'sekolah') { Schools::where('user_id', $role->id)->delete(); } return redirect('dashboard/admin/users'); } elseif ($tipe == 'activity') { Articles::where('id', $id)->delete(); return redirect('dashboard/admin/activities'); } }
public function deleteevent($id) { Events::where('id', $id)->delete(); $upload_folder = '/img/event/'; unlink(public_path() . $upload_folder . $id . '.jpg'); return redirect('dashboard/organisasi'); }
public function get_soc_mem_details($type, $id) { if (\Auth::check()) { $user = User::where('email', Session::get('email'))->first(); if ($user->priviliges == 1) { $soc = User::where('id', $id)->get()->first(); $members = Members::where('soc_id', $soc['email'])->where('type', $type)->get(); $members = $members->toArray(); foreach ($members as $key => $field) { if ($members[$key]['events'] != '' && $members[$key]['events'] != null && $members[$key]['events'] != 'null') { $x = EventDetails::where('event_id', $members[$key]['events'])->first(); if ($x != '') { $members[$key]['events'] = EventDetails::where('event_id', $members[$key]['events'])->first()->event_name; } else { $members[$key]['events'] = ''; } } } $disp_events = Events::where('society_email', $soc->email)->get()->pluck('event_id'); $disp_event_details = array(); foreach ($disp_events as $disp) { $disp_event_details[] = EventDetails::where('event_id', $disp)->first(); } return \View::make('team_table', array('members' => $members, 'type' => $type, 'disp_events' => $disp_event_details)); } } return Route::back(); }
public function del_soc($id) { if (\Auth::check()) { $user = User::where('email', Session::get('email'))->first(); if ($user->priviliges == 1) { $soc = User::where('id', $id)->first(); $events = Events::where('society_email', $soc->email)->get(); if ($events) { foreach ($events as $eve) { $event_details = EventDetails::where('event_id', $eve->event_id)->delete(); $eve->delete(); } } } if ($soc->delete()) { return Redirect::route('admin_panel'); } } return Redirect::route('admin_panel'); }
public function eventAttendees(Request $request, $event_id) { return Response::json(["status" => "OK", "response" => Events::where('id', $event_id)->with('attendees')->first()], 200); }