本文整理汇总了PHP中Events::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Events::where方法的具体用法?PHP Events::where怎么用?PHP Events::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Events
的用法示例。
在下文中一共展示了Events::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIndex
public function getIndex($route = '', $content = '', $idContent = '')
{
if ($route == '') {
$event = Events::where('title', '=', 'CURSO')->take(1)->get();
$courses = isset($event[0]) ? $event[0]->getPublishCourses() : null;
foreach ($courses as $course) {
$course->start = date("d-m-Y", strtotime($course->start));
$course->end = date("d-m-Y", strtotime($course->end));
}
return View::make('frontend.courses.index')->with(array('courses' => $courses));
} elseif ($route != '') {
$course = Courses::findRoute($route);
if ($course) {
$course->start = date("d-m-Y", strtotime($course->start));
$course->end = date("d-m-Y", strtotime($course->end));
switch ($content) {
case '':
return self::getCourseContent($route, $course, $idContent);
break;
case 'conteudo':
return self::getCourseContent($route, $course, $idContent);
break;
/*
case 'inscricoes':
return self::getCourseInscription( $route, $course, $idContent );
break;
case 'trabalhos':
return self::getCourseWorks( $route, $course, $idContent );
break;
*/
/*
case 'inscricoes':
return self::getCourseInscription( $route, $course, $idContent );
break;
case 'trabalhos':
return self::getCourseWorks( $route, $course, $idContent );
break;
*/
case 'acesso':
return self::getCourseSignin($route, $course, $idContent);
break;
case 'arquivos':
return self::getCourseFiles($route, $course, $idContent);
break;
case 'trabalhosactualizacao':
return self::getCourseFilesUploaded($route, $course, $idContent);
break;
case 'pagamento':
return self::getCoursePayment($route, $course, $idContent);
break;
default:
return self::getCourseContent($route, $course, $idContent);
break;
}
} else {
return View::make('specialpages.404');
}
}
}
示例2: isExist
/**
* undocumented function
*
* @return void
* @author
**/
public static function isExist($id)
{
$count = Events::where('event_category_id', $id)->count();
if ($count > 0) {
return true;
}
return false;
}
示例3: get_index
public function get_index()
{
$event = Events::where('status', '=', 3)->get();
if (is_null($event)) {
return json_encode('Event not found', 404);
} else {
return json_encode($event);
}
}
示例4: getIndex
public function getIndex()
{
$event = Events::where('title', '=', 'EVENTOS')->take(1)->get();
$courses = isset($event[0]) ? $event[0]->getPublishCourses() : null;
foreach ($courses as $course) {
$course->start = date("d-m-Y", strtotime($course->start));
$course->end = date("d-m-Y", strtotime($course->end));
}
return View::make('frontend.events.index')->with(array('courses' => $courses));
}
示例5: getEvents
public function getEvents()
{
$inputs = Input::all();
$term = $inputs['term'];
$result = Events::where('name', 'LIKE', '%' . $term . '%')->select('name as label', 'id')->get();
if (isset($result)) {
return Response::json($result);
}
return Response::json(array("status" => "clear"));
}
示例6: postGetEvent
public function postGetEvent()
{
$school_id = $this->getSchoolId();
$all_events = Events::where('school_id', '=', $school_id)->get();
$i = 0;
foreach ($all_events as $all_event) {
$event_type_name = EventTypes::where('id', '=', $all_event->category)->get()->first();
$all_events[$i++]['category'] = $event_type_name->event_type_name;
}
return Response::json($all_events);
}
示例7: getIndex
public function getIndex()
{
$event = Events::where('title', '=', 'EVENTOS')->take(1)->get();
$courses = isset($event[0]) ? $event[0]->getPublishCourses(3) : null;
$banner = SFNews::where('sticky', '=', '0')->where('category', '=', '0')->where('status', '=', '1')->where('home', '=', '1')->orderBy('date', 'DESC')->take(3)->get();
$principal = SFNews::where('sticky', '=', '0')->where('category', '=', '1')->where('status', '=', '1')->where('home', '=', '1')->orderBy('date', 'DESC')->take(1)->get();
$news = SFNews::where('status', '=', '1')->where('home', '=', '1')->orderBy('date', 'DESC')->take(3)->get();
$video = SFVideos::where('position', '=', '1')->take(1)->get();
$video = isset($video[0]) ? $video[0] : null;
$args = array('news' => $news, 'courses' => $courses, 'principal' => $principal, 'banner' => $banner, 'video' => $video);
return View::make('frontend.home.index')->with($args);
}
示例8: isExist
/**
* undocumented function
*
* @return void
* @author
**/
public static function isExist($id)
{
$count1 = SocialTarget::where('city_id', $id)->count();
$count2 = SocialAction::where('city_id', $id)->count();
$count3 = Events::where('city_id', $id)->count();
$count4 = User::where('city_id', $id)->count();
$count = $count1 + $count2 + $count3 + $count4;
if ($count > 0) {
return true;
}
return false;
}
示例9: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$this->info("searching for event candidates...");
// get all relevant events
$all_events = Events::where('ticketsystem_enabled', 1)->where('ticketsystem_autoremind', 1)->whereNotNull('ticketsystem_autoremind_user_id')->whereNotNull('ticketsystem_recording_startdate')->get();
error_log('All Events ' . json_encode($all_events));
$curr_year = date("Y", strtotime('now'));
$curr_week = date("W", strtotime('now'));
// iterate to get at the event ticket types without sales
foreach ($all_events as $key => $curr_event) {
$this->info("event with ticketsystem enabled found...");
// event ticket types
$ticket_types = $curr_event->ticket_types()->get();
$event_has_incomplete_sales = false;
foreach ($ticket_types as $key => $tt) {
// No point sending multiple notifications for same event and different ticket types
if ($event_has_incomplete_sales) {
break;
}
$this->info("searching event ticket types...");
for ($days_added = 0;; $days_added += 7) {
$cmp_ts = strtotime($curr_event->ticketsystem_recording_startdate . " +" . $days_added . " days");
if ($cmp_ts > strtotime('now')) {
break;
}
// get the week and year
$cmp_year = date("Y", $cmp_ts);
$cmp_week = date("W", $cmp_ts);
// get the ones without sales entries at some week between ticketsystem startdate and now
$tt_weekly_sales = TicketSold::where('event_ticket_types_id', $tt->id)->where('week', $cmp_week)->where('year', $cmp_year)->first();
if (!$tt_weekly_sales) {
$this->comment("notifying promoter...");
// get the user to be notified
$promoter = User::find($curr_event->ticketsystem_autoremind_user_id);
// create autologin entry
$confirmation_code = str_random(30);
$autologin_entry = TicketSalesAutologin::create(['users_id' => $promoter->id, 'events_id' => $curr_event->id, 'token' => $confirmation_code]);
if ($autologin_entry) {
// send notification
Mail::send('emails.promoters.incomplete_sales', array('promoter' => $promoter, 'curr_event' => $curr_event, 'autologin' => $autologin_entry), function ($message) use($promoter) {
$message->to($promoter->email, $promoter->username)->subject("Alda: Incomplete ticket sales");
});
}
$event_has_incomplete_sales = true;
break;
}
}
}
}
}
示例10: getSession
public function getSession($id)
{
// init
$data = array();
$event = Events::where('id', $id)->first();
if ($event == false) {
return App::abort('404');
}
$data['view'] = $event;
// // get photos
$data['photos'] = Photo::where('type_name', '=', 'events')->where('type_id', '=', $event->id)->where('status', '=', 1)->get();
$data['social_actions'] = SocialAction::with(array('city', 'category'))->join('social_action_events', 'social_action_events.social_action_id', '=', 'social_actions.id')->where('event_id', '=', $event->id)->where('social_actions.status', '=', 1)->orderBy('social_actions.id', 'desc')->get();
$data['social_target_id'] = SocialTarget::getAll();
$data['social_action_category_id'] = SocialActionCategory::getAll();
$data['city_id'] = City::getAll();
Session::put('type_name', 'Events');
Session::forget('type_id');
Session::put('event_id', $event['id']);
return Redirect::route('buat-aksi-sosial');
}
示例11: eventModify
public function eventModify()
{
$evId = Input::get('evId');
Events::where('evId', $evId)->update(array('evName' => Input::get('evName'), 'evIntro' => Input::get('evIntro'), 'evRules' => Input::get('evRules'), 'evCat' => Input::get('evCat')));
$phone = Input::get('phone');
$k = Organizer::where('evId', $evId);
if ($k) {
$k->delete();
}
foreach (Input::get('name') as $key => $name) {
if (strlen($name) > 0) {
$organizer = new Organizer();
$organizer->name = $name;
if (strlen($phone[$key]) > 0) {
$organizer->phone = $phone[$key];
}
$organizer->evId = $evId;
$organizer->save();
}
}
return Redirect::to('admin/event/' . $evId)->with('isErr', false)->with('msg', 'Successfully updated event.');
}
示例12: delete_event_image_1
public function delete_event_image_1()
{
try {
$sequence = 0;
$id = Input::get('id');
$_arrayImages = explode(";", Input::get('images'));
$images = $_arrayImages;
$image = Input::get('image');
$new_image = '';
foreach ($images as $_image) {
if ($_image != $image) {
if ($sequence == count($images) - 1) {
$new_image .= $_image;
} else {
$new_image .= $_image . ';';
}
}
$sequence++;
}
if (ends_with($new_image, ';')) {
$_arrayImages = '';
$_arrayImages = explode(";", $new_image);
$new_image = '';
$sequence = 0;
foreach ($_arrayImages as $_image) {
$sequence++;
if ($sequence < count($images) - 1) {
$new_image .= $_image . ';';
} else {
if ($sequence == count($images) - 1) {
$new_image .= $_image;
}
}
}
}
$isUpdate = Events::where('eventId', $id)->update(array('eventPicturesContent' => $new_image));
return Response::json(['status' => 'success', 'msg' => 'Đăng nhập thành công!']);
} catch (Exception $_ex) {
Log::error('Error: ' . $_ex);
return Response::json(['status' => 'error', 'msg' => 'Đăng nhập thành công!']);
}
}
示例13: getEvents
public function getEvents()
{
/*
Get all events asociated with logged in promoter
*/
//check if user is authenticated
$auser = Auth::user();
if (!$auser) {
eerror_log('user not authenticated');
return Response::json((object) null);
}
// storage
$all_user_events = [];
////////////////////////////////
// associated through company //
////////////////////////////////
$user = User::find($auser->id);
if (!$user) {
eerror_log('could not find user');
return Response::json((object) null);
}
// non fatal - no company associated
if (!$user->company()->first()) {
eerror_log('no company associated with user');
}
if ($user && $user->company()->first()) {
eerror_log('company found');
// get them all
$user_companies = $user->company()->get();
foreach ($user_companies as $company_ndx => $company_val) {
// get associated events
$tmp_company_events = $company_val->events()->get();
eerror_log('>>> company ' . json_encode($company_val));
eerror_log('>>> company events ' . json_encode($tmp_company_events));
foreach ($tmp_company_events as $cevents_ndx => $cevents_val) {
// dump them
$all_user_events[] = $cevents_val;
}
}
}
/////////////////////
// associated with //
/////////////////////
$user_events = $user->events()->get();
foreach ($user_events as $user_eventsr_key => $user_event) {
$all_user_events[] = $user_event;
Debugbar::info('added event user', $user_event);
}
////////////////
// created by //
////////////////
$events_created_by_user = Events::where('created_by', $user->id)->get();
foreach ($events_created_by_user as $events_created_by_user_key => $events_created_by_user_value) {
$all_user_events[] = $events_created_by_user_value;
}
$resp = [];
$company_events = null;
if (count($all_user_events) > 0) {
foreach ($all_user_events as $event_ndx => $curr_event) {
$event_details = $this->getDetails($curr_event);
if (strtotime($event_details['date']) < strtotime('now')) {
eerror_log('>>>>>>>>>>>> Event Date is in the past ' . json_encode($event_details['date']));
continue;
}
$cats = $this->getTaskCategories();
$company_events[] = $curr_event;
$event_tasks = $this->getTasks($curr_event);
$categorized_event_tasks = $this->getCategorizedTasks($curr_event);
// Le tickets
list($ticket_types, $ticket_aggregate, $yearly_tickettype_aggregate, $global_aggregate) = $this->getTickets($curr_event);
// calc cumulative task updates for current event
$event_updates_files = 0;
$event_updates_comments = 0;
foreach ($event_tasks as $task_ndx => $curr_task) {
if ($curr_task['info']['status'] === "incomplete") {
$event_updates_files += (int) $curr_task['info']['cnt_updated_files'];
$event_updates_comments += (int) $curr_task['info']['cnt_updated_comments'];
}
}
$resp[] = ['cats' => $cats, 'currencies' => $this->getCurrencies(), 'cat_tasks' => $categorized_event_tasks, 'details' => $event_details, 'due_date' => strtotime($event_details['deadline']), 'event' => $curr_event, 'logged_in_id' => $user->id, 'tasks' => $event_tasks, 'ticket_types' => $ticket_types, 'tickets' => $ticket_aggregate, 'tickets_yearly' => $yearly_tickettype_aggregate, 'global_sales' => $global_aggregate, 'updated_files' => $event_updates_files, 'updated_comments' => $event_updates_comments];
}
}
return Response::json($resp);
}
示例14: createPost
public function createPost()
{
if (Request::isMethod('post')) {
$input = Input::all();
$postEvent = SocialTarget::StoreSocialTarget($input);
if (array_key_exists('msg', $postEvent) && $postEvent['msg'] == 'ok') {
// check if any mutliple upload photo
$CountPhoto = Photo::where('tmp', Session::get('time'))->count();
if ($CountPhoto > 0) {
Photo::updatePhotos('social_targets', $postEvent['id']);
Photo::roolback();
// set default photo
$setPhoto = Photo::where('user_id', Auth::user()->id)->where('type_name', 'social_targets')->where('type_id', $postEvent['id'])->first();
$setPhotoRow = array('default_photo_id' => $setPhoto->id);
Events::where('id', $postEvent['id'])->update($setPhotoRow);
}
Session::flash('sukses', 'Target Sosial Berhasil di Rekap');
return Redirect::route('admin.social-target')->withInput();
} else {
// get session validation
Session::put('validasi', 'social_targets');
Session::flash('validasi', $postEvent);
return Redirect::route('admin.social-target.create')->withInput(Input::except('social_target_category_id', 'user_id', 'city_id'));
}
}
}
示例15: UpdateEvent
public static function UpdateEvent($input)
{
$id = $input['id'];
$rules = array('event_category_id' => 'required', 'city_id' => 'required', 'name' => 'required', 'stewardship' => 'required|min:5', 'description' => 'required|min:5', 'location' => 'required', 'started_at' => 'required', 'ended_at' => 'required');
$validator = Validator::make($input, $rules);
if ($validator->fails()) {
return $validator->errors()->all();
} else {
$started_at = empty($input['started_at']) ? 'no' : preg_split("/([\\/: ])/", $input['started_at']);
$ended_at = empty($input['ended_at']) ? 'no' : preg_split("/([\\/: ])/", $input['ended_at']);
$input = array('event_category_id' => $input['event_category_id'], 'city_id' => $input['city_id'], 'email' => $input['email'], 'name' => $input['name'], 'user_id' => Auth::check() ? Auth::user()->id : '', 'stewardship' => $input['stewardship'], 'description' => $input['description'], 'location' => $input['location'], 'website_url' => $input['website_url'], 'social_media_urls' => $input['social_media_urls'], 'status' => $input['status'], 'started_at' => mktime((int) $started_at[3], (int) $started_at[4], 0, (int) $started_at[0], (int) $started_at[1], (int) $started_at[2]), 'ended_at' => mktime((int) $ended_at[3], (int) $ended_at[4], 0, (int) $ended_at[0], (int) $ended_at[1], (int) $ended_at[2]), 'created_at' => time(), 'updated_at' => time());
$getSlug = Events::where('id', $id)->first();
$slug = Str::slug($input['name']);
// jika input tidak sama dengan slug di database
if (strcmp($input['name'], $getSlug['name']) != 0) {
$checkSlug = Events::where('slug', $slug)->where('id', '!=', $id)->count();
if ($checkSlug > 0) {
$input['slug'] = $slug . "-" . $id;
} else {
$input['slug'] = $slug;
}
}
$photo = Photo::updateAvatar($getSlug['cover_photo_id'], 'events', $getSlug->id);
$input['cover_photo_id'] = $photo['cover_photo_id'];
$event = Events::find($id);
$event->fill($input);
$event->save();
return "ok";
}
}