本文整理汇总了PHP中Location::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Location::find方法的具体用法?PHP Location::find怎么用?PHP Location::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Location
的用法示例。
在下文中一共展示了Location::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_delete
public function action_delete($id)
{
if (Session::has('id')) {
$account = Account::find(Session::get('id'));
$location = Location::find($id);
$owner = Account::find($location->account_id);
if ($account->id == $owner->id) {
$listings = Listing::where_location_id($location->id);
// foreach($listings as $listing)
// {
// $images = Image::where_listing_id($listing->id);
// foreach($images as $image)
// {
// $image->delete();
// }
// $listing->delete();
// }
$location->delete();
return Redirect::to('/account/myLocations/');
} else {
return Redirect::to('/');
}
} else {
return Redirect::to('/');
}
}
示例2: getObjectStructure
static function getObjectStructure()
{
global $user;
//Load Libraries for lookup values
$location = new Location();
$location->orderBy('displayName');
if ($user->hasRole('libraryAdmin')) {
$homeLibrary = Library::getPatronHomeLibrary();
$location->libraryId = $homeLibrary->libraryId;
}
$location->find();
$locationList = array();
while ($location->fetch()) {
$locationList[$location->locationId] = $location->displayName;
}
require_once ROOT_DIR . '/sys/Browse/BrowseCategory.php';
$browseCategories = new BrowseCategory();
$browseCategories->orderBy('label');
$browseCategories->find();
$browseCategoryList = array();
while ($browseCategories->fetch()) {
$browseCategoryList[$browseCategories->textId] = $browseCategories->label . " ({$browseCategories->textId})";
}
$structure = array('id' => array('property' => 'id', 'type' => 'label', 'label' => 'Id', 'description' => 'The unique id of the hours within the database'), 'locationId' => array('property' => 'locationId', 'type' => 'enum', 'values' => $locationList, 'label' => 'Location', 'description' => 'A link to the location which the browse category belongs to'), 'browseCategoryTextId' => array('property' => 'browseCategoryTextId', 'type' => 'enum', 'values' => $browseCategoryList, 'label' => 'Browse Category', 'description' => 'The browse category to display '), 'weight' => array('property' => 'weight', 'type' => 'numeric', 'label' => 'Weight', 'weight' => 'Defines how lists are sorted within the widget. Lower weights are displayed to the left of the screen.', 'required' => true));
foreach ($structure as $fieldName => $field) {
$field['propertyOld'] = $field['property'] . 'Old';
$structure[$fieldName] = $field;
}
return $structure;
}
示例3: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
if (Location::got_property($id) == false) {
$this->location->find($id)->delete();
}
return Redirect::route('admin.locations.index');
}
示例4: getCountryList
public function getCountryList()
{
/* Start here set the country list */
App::import("Model", "Location");
$location = new Location();
$options = array('fields' => array('Location.county_name'));
return $getLocationArray = $location->find('list', $options);
}
示例5: sightings
/**
* Show the form for adding sightings.
*
* @param int $id
* @return View
*/
public function sightings($id)
{
// retrieve current sightings
$sightings = DB::select('CALL proc_listSightingsForTrip(?);', [$id]);
$trip = Trip::find($id);
$location = Location::find($trip->location_id);
return View::make('admin/trips/sightings')->with(['sightings' => $sightings])->with(['location' => $location])->with(['trip' => $trip]);
}
示例6: getLocationDatabase
public function getLocationDatabase()
{
$locData = Location::find('all');
$data = array();
foreach ($locData as $location) {
$data[] = array('prefix' => $location->prefix, 'shortname' => $location->name, 'name' => $location->name . ', ' . $location->country, 'lat' => $location->lat, 'lon' => $location->lon, 'pop' => $location->population);
}
$this->output = $data;
}
示例7: update
public function update($id)
{
$location = Location::find($id);
$location->code = Input::get('code');
$location->name = Input::get('name');
$location->address = Input::get('address');
$location->contact = Input::get('contact');
$location->save();
Session::flash('message', 'Sukses mengupdate cabang!');
}
示例8: postMobile
public function postMobile()
{
$donations = Input::get('mobile_campaign_id');
foreach ($donations as $mobileID) {
$mobile = Location::find($mobileID);
}
//Session::flash('success', 'Successfully selected mobiles!');
//return Redirect::action('DonationController@getMobiles');
return Redirect::route('donation.getMobile');
}
示例9: execute
public function execute($lastRunDt = null)
{
$config = Zend_Registry::get('config');
$checkDtStart = new Zend_Date($this->_lastRunDt);
$checkDtStart->subHour($config->user->numHoursEvaluationReminder->val);
$checkDtEnd = new Zend_Date();
$checkDtEnd->subHour($config->user->numHoursEvaluationReminder->val);
$event = new Event();
$events = $event->getEvents(null, null, null, $checkDtStart->getTimestamp(), $checkDtEnd->getTimestamp(), 'open');
$location = new Location();
$workshop = new Workshop();
$instructor = new Event_Instructor();
$attendee = new Event_Attendee();
$eu = new Evaluation_User();
foreach ($events as $e) {
$startDt = strtotime($e->date . ' ' . $e->startTime);
$endDt = strtotime($e->date . ' ' . $e->endTime);
if ($checkDtStart->getTimestamp() < $endDt && $checkDtEnd->getTimestamp() >= $endDt) {
$evalAvailableDt = new Zend_Date($endDt);
$evalAvailableDt->addHour($config->user->numHoursEvaluationAvailability->val);
if ($evalAvailableDt->getTimestamp() > time()) {
$taken = $eu->getCompleted($e->eventId);
$thisLocation = $location->find($e->locationId);
if (is_null($thisLocation)) {
throw new Ot_Exception_Data('msg-error-noLocation');
}
$thisWorkshop = $workshop->find($e->workshopId);
if (is_null($thisWorkshop)) {
throw new Ot_Exception_Data('msg-error-noWorkshop');
}
$instructors = $instructor->getInstructorsForEvent($e->eventId);
$instructorNames = array();
$instructorEmails = array();
foreach ($instructors as $i) {
$instructorNames[] = $i['firstName'] . ' ' . $i['lastName'];
$instructorEmails[] = $i['emailAddress'];
}
$data = array('workshopName' => $thisWorkshop->title, 'workshopDate' => date('m/d/Y', $startDt), 'workshopStartTime' => date('g:i a', $startDt), 'workshopEndTime' => date('g:i a', $endDt), 'workshopMinimumEnrollment' => $e->minSize, 'workshopCurrentEnrollment' => $e->roleSize, 'locationName' => $thisLocation->name, 'locationAddress' => $thisLocation->address, 'instructorNames' => implode(', ', $instructorNames), 'instructorEmails' => implode(', ', $instructorEmails));
$attending = $attendee->getAttendeesForEvent($e->eventId, 'attending');
foreach ($attending as $a) {
if ($a['attended'] == 1 && !in_array($a['accountId'], $taken)) {
$trigger = new Ot_Trigger();
$trigger->setVariables($data);
$trigger->accountId = $a['accountId'];
$trigger->studentEmail = $a['emailAddress'];
$trigger->studentName = $a['firstName'] . ' ' . $a['lastName'];
$trigger->studentUsername = $a['username'];
$trigger->dispatch('Event_Evaluation_Reminder');
}
}
}
}
}
}
示例10: show
/**
* Display the specified resource.
* GET /location/{id}
*
* @param int $id
* @return Response
*/
public function show($id)
{
$CalendarEvent = CalendarEvent::find($id);
$EventID = $CalendarEvent->location_id;
$Location = Location::find($EventID);
if (!$CalendarEvent) {
Session::flash('errorMessage', "Blog post was not found");
App::abort(404);
}
Log::info(Input::all());
return View::make('/event')->with(array('event' => $CalendarEvent, 'location' => $Location));
}
示例11: action_delete
public function action_delete()
{
if (Session::has('id') && Auth::check() && Input::has('file') && Input::has('listing_id')) {
$account = Account::find(Session::get('id'));
$listing = Listing::find(Input::get('listing_id'));
$location = Location::find($listing->location_id);
if ($account->id == $location->account_id) {
unlink(Input::get('file'));
} else {
die("Image does not belogn to user");
}
}
}
示例12: remove
public function remove($id)
{
$adminId = Session::get('admin_id');
if (!isset($adminId)) {
return json_encode(array('message' => 'not logged'));
}
$location = Location::find($id);
if (is_null($location)) {
return json_encode(array('message' => 'invalid'));
} else {
$location->status = 'removed';
$location->save();
return json_encode(array('message' => 'done'));
}
}
示例13: store
/**
* Store a newly created stock in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), Stock::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$item_id = Input::get('item');
$location_id = Input::get('location');
$item = Item::findOrFail($item_id);
$location = Location::find($location_id);
$quantity = Input::get('quantity');
$date = Input::get('date');
Stock::addStock($item, $location, $quantity, $date);
return Redirect::route('stocks.index')->withFlashMessage('stock has been successfully updated!');
}
示例14: request
/**
* Request a specific Inventory from View Page
*
* @param Request $request (Ajax)
* @param Inventory $item
*
* @return array
*/
public function request(Request $request, Inventory $item)
{
/**
* If stock don't exist for this item, create it in location 1 (Nonlocated)
* with zero quantity.
* If stock exist, fetch the stock from record.
*/
if (count($item->stocks) == 0) {
$stock = $item->newStockOnLocation(Location::find(1));
$stock->quantity = 0;
$stock->save();
} else {
$stock = InventoryStock::where('inventory_id', $item->id)->first();
}
// Create new Request Transaction (order-requested)
$transaction = $stock->newTransaction();
$transaction->requested($request->quantity);
return $transaction;
}
示例15: getObjectStructure
function getObjectStructure()
{
//Look lookup information for display in the user interface
$location = new Location();
$location->orderBy('displayName');
$location->find();
$locationList = array();
$locationLookupList = array();
$locationLookupList[-1] = '<No Nearby Location>';
while ($location->fetch()) {
$locationLookupList[$location->locationId] = $location->displayName;
$locationList[$location->locationId] = clone $location;
}
$structure = array('ip' => array('property' => 'ip', 'type' => 'text', 'label' => 'IP Address', 'description' => 'The IP Address to map to a location formatted as xxx.xxx.xxx.xxx/mask'), 'location' => array('property' => 'location', 'type' => 'text', 'label' => 'Display Name', 'description' => 'Descriptive information for the IP Address for internal use'), 'locationid' => array('property' => 'locationid', 'type' => 'enum', 'values' => $locationLookupList, 'label' => 'Location', 'description' => 'The Location which this IP address maps to'));
foreach ($structure as $fieldName => $field) {
$field['propertyOld'] = $field['property'] . 'Old';
$structure[$fieldName] = $field;
}
return $structure;
}