本文整理汇总了PHP中Place::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Place::where方法的具体用法?PHP Place::where怎么用?PHP Place::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Place
的用法示例。
在下文中一共展示了Place::where方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: placeFrom
private function placeFrom($id)
{
if ($cityFr = Place::where('id', '=', $id)->first()) {
return $cityFr->full_name;
} else {
return null;
}
}
示例2: editClubEvent
/**
* Edit or create a clubevent with its entered information.
* If $id is null create a new clubEvent, otherwise the clubEvent specified by $id will be edit.
*
* @param int $id
* @return ClubEvent clubEvent
*/
private function editClubEvent($id)
{
$event = new ClubEvent();
if (!is_null($id)) {
$event = ClubEvent::findOrFail($id);
}
// format: strings; no validation needed
$event->evnt_title = Input::get('title');
$event->evnt_subtitle = Input::get('subtitle');
$event->evnt_public_info = Input::get('publicInfo');
$event->evnt_private_details = Input::get('privateDetails');
$event->evnt_type = Input::get('evnt_type');
// create new place
if (!Place::where('plc_title', '=', Input::get('place'))->first()) {
$place = new Place();
$place->plc_title = Input::get('place');
$place->save();
$event->plc_id = $place->id;
} else {
$event->plc_id = Place::where('plc_title', '=', Input::get('place'))->first()->id;
}
// format: date; validate on filled value
if (!empty(Input::get('beginDate'))) {
$newBeginDate = new DateTime(Input::get('beginDate'), new DateTimeZone(Config::get('app.timezone')));
$event->evnt_date_start = $newBeginDate->format('Y-m-d');
} else {
$event->evnt_date_start = date('Y-m-d', mktime(0, 0, 0, 0, 0, 0));
}
if (!empty(Input::get('endDate'))) {
$newEndDate = new DateTime(Input::get('endDate'), new DateTimeZone(Config::get('app.timezone')));
$event->evnt_date_end = $newEndDate->format('Y-m-d');
} else {
$event->evnt_date_end = date('Y-m-d', mktime(0, 0, 0, 0, 0, 0));
}
// format: time; validate on filled value
if (!empty(Input::get('beginTime'))) {
$event->evnt_time_start = Input::get('beginTime');
} else {
$event->evnt_time_start = mktime(0, 0, 0);
}
if (!empty(Input::get('endTime'))) {
$event->evnt_time_end = Input::get('endTime');
} else {
$event->evnt_time_end = mktime(0, 0, 0);
}
// format: tinyInt; validate on filled value
// reversed this: input=1 means "event is public", input=0 means "event is private"
$event->evnt_is_private = Input::get('isPrivate') == '1' ? 0 : 1;
return $event;
}