本文整理汇总了PHP中Address::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Address::all方法的具体用法?PHP Address::all怎么用?PHP Address::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Address
的用法示例。
在下文中一共展示了Address::all方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Returns home page of all the wells, the index.
*
* @return index.blade.php View
*/
public function index()
{
/*
Sets the Well Variable to null, or to the current users well. Used
for populating the well modal (not model, I'm talking about the
bootstrap component) with information
*/
if (Auth::check()) {
if (Address::where('user_id', Auth::user()->id)->first()) {
$well = Address::where('user_id', Auth::user()->id)->first();
} else {
$well = null;
}
}
//Gets all the Addresses from the database, then puts them into JSON so Javascript can read it.
$addresses = Address::all();
$addresses = json_encode($addresses);
return View::make('index', compact('addresses', 'well'));
}
示例2: index
public function index()
{
$aryDrug = Drug::all();
$objJson = array();
foreach ($aryDrug as $drug) {
switch ($drug->type) {
case 1:
$objJson[] = array("type" => $drug->type, "defaults" => array("morning" => $drug->morning, "lunch" => $drug->lunch, "afternoon" => $drug->afternoon, "night" => $drug->night), 'total' => -1);
break;
case 2:
case 3:
$objJson[] = array("type" => $drug->type, "fixed" => $drug->fixed, "special" => $drug->special);
break;
case 4:
$objJson[] = array("type" => $drug->type, "fixed" => $drug->fixed);
break;
}
}
return View::make('medical.medical', array('address' => Address::all(), 'diseases' => Disease::all(), 'drugs' => Drug::all(), 'current_day' => Config::get('constants.current_day', 3), 'max_day' => Config::get('constants.max_day', 7), 'drug' => json_encode($objJson)));
}
示例3: pod
public function pod()
{
$addresses = \Address::all();
return View::make('support/pod', compact('addresses'));
}
示例4: index
public function index()
{
return Response::json(array('address' => Address::all(), 'diseases' => Disease::all(), 'drugs' => Drug::all(), 'current_day' => Config::get('constants.current_day', 3), 'max_day' => Config::get('constants.max_day', 7)));
}
示例5: index
/**
* Display a listing of addresses
*
* @return Response
*/
public function index()
{
$addresses = Address::all();
return View::make('addresses.index', compact('addresses'));
}
示例6: json_encode
$newAddress->complement = $complement;
$newAddress->neighborhood = $neighborhood;
$newAddress->city = $city;
$newAddress->state = $state;
if ($newAddress->save()) {
$data['msg'] = 'Address saved successfully!';
$data['id'] = $newAddress->id;
} else {
$data['msg'] = 'An error occurred while saving the address!';
}
$contactList->response()->header('Content-Type', 'application/json');
echo json_encode($data);
});
// Get all address to one contact
$contactList->get("/addresses", function () use($contactList) {
$addresses = Address::all();
$contactList->response()->header('Content-Type', 'application/json');
echo json_encode(objectToArray(json_decode($addresses)));
});
// Get specific address
$contactList->get("/addresses/:id", function ($id) use($contactList) {
$addresses = Address::find($id);
$contactList->response()->header('Content-Type', 'application/json');
echo json_encode(objectToArray(json_decode($addresses)));
});
// Add new address
$contactList->post("/addresses", function () use($contactList) {
$contactId = $contactList->request->params('contactid');
$zipcode = $contactList->request->params('zipcode');
$address = $contactList->request->params('address');
$complement = $contactList->request->params('complement');