本文整理汇总了PHP中Service::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::find方法的具体用法?PHP Service::find怎么用?PHP Service::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Service
的用法示例。
在下文中一共展示了Service::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: change_template
public function change_template()
{
App::import('Model', 'Service');
$mService = new Service();
$service = $mService->find('first', array('conditions' => array('Service.id' => $this->request->data['idService'])));
echo json_encode($service['Service']);
die;
}
示例2: createModel
public function createModel()
{
$model = new Service();
$criteria = new CDbCriteria();
$criteria->select = new CDbExpression('MAX(sort) as sort');
$max = $model->find($criteria);
$model->sort = $max->sort + 10;
return $model;
}
示例3: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($encadrantId = null, $serviceId = null)
{
if (is_null($serviceId)) {
return Encadrant_Service_Etudiant::join('Service', 'Service.id_Service', '=', 'Encadrant_Service_Etudiant.id_Stage')->select('Service.*')->where('Encadrant_Service_Etudiant.id_Enseignant', '=', $encadrantId)->distinct()->get();
} else {
$service = Service::find($serviceId);
return is_null($stage) ? response()->json(['error' => 'stage Note not found'], HttpResponse::HTTP_NOT_FOUND) : $service;
}
}
示例4: getInfos
/**
* Infos pop-up clic marqueur bus
*/
public function getInfos()
{
$infoBus = Service::find(Input::get('service'));
$ligne = $infoBus->ligne;
$service = $infoBus->service;
$heure = date('H:i:s');
$arretSuivant = Horaire::getNextArret($heure, $service);
return Response::json($arretSuivant);
}
示例5: edit
public static function edit($id)
{
$service = Service::find($id);
// $offeredServices = OfferedServices::findByService($id);
$employees = Employee::all();
//
$employeeList = OfferedServicesController::getEmployees($id, $employees);
View::make('service/edit.html', array('attributes' => $service, 'employeeList' => $employeeList, 'employees' => $employees));
}
示例6: connectServiceWithLocation
/**
* Creates a relation between a specific Advisor and a specific Location
*
* @var array
*/
public function connectServiceWithLocation($services, $advisor_id, $location_id)
{
foreach ($services as $service_id) {
$advisor = Advisor::find($advisor_id);
$advisor->services()->attach($service_id);
$service = Service::find($service_id);
$service->locationsWithAdvisor()->attach($location_id, ['advisor_id' => $advisor_id]);
}
return $services;
}
示例7: getInfo
/**
* 获取服务信息
*
* @return object
*/
public static function getInfo($id, $key = 'name')
{
if (!$id) {
return '<font color="grey">无此服务</font>';
}
$service = Service::find($id);
if (empty($service)) {
return '<font color="grey">无此服务</font>';
}
return $service->{$key};
}
示例8: myserviceToHtml
/**
* 我的服务转换为html
*
* @return string
*/
public function myserviceToHtml()
{
if (!$this->services_id) {
return '<font color="grey">无</font>';
}
$services = Service::find($this->services_id);
if (empty($services)) {
return '<font color="grey">无此服务</font>';
}
$class = 'badge-default';
$text = $services->name;
return "<span class=\"badge {$class}\">{$text}</span>";
}
示例9: addToCart
function addToCart()
{
if (!Input::get('option')) {
return Redirect::to('order');
}
if (!Input::get('cycle')) {
return Redirect::to('order');
}
$option = ServiceOption::find(Input::get('option'));
$service = Service::find($option->service_id);
$cycle = BillingCycle::find(Input::get('cycle'));
Cart::insert(array('id' => $option->id, 'name' => $service->name . ' ' . $option->option_name, 'price' => $option->base_price, 'quantity' => $cycle->cycle));
return Redirect::to('order');
}
示例10: sandbox
public static function sandbox()
{
$service = Service::find(1);
$services = Service::all();
$employees = Employee::all();
$employee = Employee::find(1);
$service2 = new Service(array('name' => 'aasdd', 'price' => "2", 'description' => "asfafaf"));
$errors = $service2->errors();
Kint::dump($employee);
Kint::dump($employees);
Kint::dump($service);
Kint::dump($services);
Kint::dump($errors);
// View::make('helloworld.html');
}
示例11: update
private function update($tabla)
{
switch ($tabla) {
case 'Service':
$service = Service::update($service_id, array('driver_id' => $driver_id, 'status_id' => "2", 'car_id' => $driver_tmp->car_id));
$this->servicio = Service::find($this->servicio_id);
$this->validar($service);
break;
case 'Driver':
$driver = Driver::update($this->driver_id, array("available" => "0"));
$this->conductor = Driver::find($this->conductor_id);
$this->validar($driver);
break;
}
}
示例12: saveModel
/**
* [saveModel - saves ou model info to the DB]
* @param boolean $service [description]
* @return [Eloquent model] [service eloquent model]
*/
protected function saveModel($service = false)
{
if (Input::get('id')) {
$service = Service::find(Input::get('id'));
}
if (!$service) {
$service = new Service();
}
$load_company_model = $service->companies;
$service->name = Input::get('name');
$service->category_id = Input::get('category_id');
$service->status_id = Input::get('status_id');
$service->invoice_periods_id = Input::get('invoice_periods_id');
$service->default_monthly_costs = Input::get('default_monthly_costs');
$service->comment = Input::get('comment');
$service->save();
return $service;
}
示例13: delete
public function delete()
{
if (Request::ajax()) {
$data['response'] = 'error';
$data['content'] = "Item cannot be deleted.";
$id = Input::get('service_id');
$package = Package::where('service_id', '=', $id)->count();
if ($package == 0) {
$service = Service::find($id);
$service->delete();
$data['response'] = 'ok';
$data['content'] = "Item was successfully deleted.";
}
$response = Response::make(json_encode($data), 200);
$response->header('Content-Type', 'text/json');
return $response;
}
}
示例14: generalAction
/**
*
*/
public function generalAction()
{
$dataRequest = $this->request->getJsonPost();
$fields = array("key", "platform");
if ($this->_checkFields($dataRequest, $fields)) {
if ($this->_validKey()) {
$services = Service::find();
$return = array();
$categories = array();
foreach ($services as $item) {
$categories = array();
foreach ($item->ServiceCategory as $item2) {
$categories[] = array("id" => $item->getId(), "name" => utf8_encode($item2->getName()), "description" => utf8_encode($item2->getDescription()), "image" => $item2->getImage(), "video" => $item2->getVideo());
}
$return[] = array("id" => $item->getId(), "name" => utf8_encode($item->getName()), "description" => utf8_encode($item->getDescription()), "image" => $item->getImage(), "categories" => $categories);
}
$this->setJsonResponse(ControllerBase::SUCCESS, ControllerBase::FAILED_MESSAGE, array("status" => $this->strings->getString("http", "success"), "message" => $this->strings->getString("platform", "success"), "data" => $return));
}
}
}
示例15: getTimeSlot
public function getTimeSlot($service_id)
{
Activity::log(['contentId' => $service_id, 'contentType' => 'Outlet', 'action' => 'getTimeSlot', 'description' => 'getTimeSlot of Service', 'details' => 'Service Id: ' . $service_id, 'updated' => false]);
$service = Service::find($service_id);
$outlet = Outlet::find($service->outlet_id);
$startTime = explode(':', $outlet->startTime);
$endTime = explode(':', $outlet->endTime);
if (count($startTime) < 2 || count($endTime) < 2) {
return array();
}
$start = mktime($startTime[0], $startTime[1], 0, 8, 12, 2014);
$end = mktime($endTime[0], $endTime[1], 0, 8, 12, 2014);
$hourArray = array();
$count = 1;
$hourArray[] = $start;
while ($start < $end && $count < 1000) {
$date = $start + $service->time_operate * 60;
$hourArray[] = $date;
$start = $date;
$count++;
}
return $hourArray;
}