本文整理汇总了PHP中Patient::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Patient::orderBy方法的具体用法?PHP Patient::orderBy怎么用?PHP Patient::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Patient
的用法示例。
在下文中一共展示了Patient::orderBy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$patientsList = Patient::orderBy(Config::get('constants.PATIENT.ATTRS.PATIENT_ID'))->get();
if (!$patientsList->count()) {
return $this->notDataFound();
}
return $this->respondWithCollection($patientsList, new PatientTransformer());
}
示例2: testDelete
/**
* Tests the update function in the PatientController
* @depends testStore
* @param void
* @return void
*/
public function testDelete()
{
$this->be(User::first());
$this->runStore($this->input);
$patientSaved = Patient::orderBy('id', 'desc')->take(1)->get()->toArray();
$patient = new PatientController();
$patient->delete($patientSaved[0]['id']);
$patientsDeleted = Patient::withTrashed()->find($patientSaved[0]['id']);
$this->assertNotNull($patientsDeleted->deleted_at);
}
示例3: testGetGender
public function testGetGender()
{
$data = array(array('patient_number' => '6666', 'name' => 'Paul Mamboleo', 'dob' => '1930-07-05', 'gender' => '0', 'email' => 'mambo@saharara.com', 'address' => 'Godric Hollows', 'phone_number' => '+189012402938', 'created_at' => '0000-00-00', 'updated_at' => '0000-00-00'), array('patient_number' => '5555', 'name' => 'Akellus Judith Pocos Black', 'dob' => '1900-07-05', 'gender' => '1', 'email' => 'buildandt@saharara.com', 'address' => '12 Grimmauld Place', 'phone_number' => '+18966602938', 'created_at' => '0000-00-00', 'updated_at' => '0000-00-00'));
Patient::insert($data);
$patientSaved = Patient::orderBy('id', 'desc')->take(2)->get()->toArray();
$patientfemale = Patient::find($patientSaved[1]['id']);
$patientmale = Patient::find($patientSaved[0]['id']);
$this->assertEquals('F', $patientfemale->getGender());
$this->assertEquals('M', $patientmale->getGender());
}
示例4: newPatient
public function newPatient()
{
$input = Input::all();
if (!is_numeric($input['address'])) {
$input['address'] = DB::table('address')->insertGetId(array('address' => $input['address']));
}
$patient = DB::table('patients')->where('full_name', $input['fullName'])->where('address', $input['address'])->first();
// if (! Until::isNull($patient) && ! Input::has('patientId') ) {
// if (! Input::has('ok')){
// return 'false';
// }
// }
$fullName = $input['fullName'];
$ary = explode(" ", $fullName);
$pop = array_pop($ary);
$patient = new Patient();
if (Input::has('patientId') && !Until::isNull($input['patientId'])) {
$patient = Patient::where('id', $input['patientId'])->first();
} else {
$temp = Patient::orderBy('id', 'desc')->first();
$pat_id = 1;
if (!Until::isNull($temp)) {
$pat_id += $temp->id;
}
$patient->patient_id = Until::convertIntToString($pat_id);
}
$patient->first_name = implode(" ", $ary) . ' ';
$patient->last_name = $pop;
$patient->full_name = $input['fullName'];
$patient->age = $input['age'];
$patient->is_month = false;
if (Input::has('isMonth')) {
$patient->is_month = true;
}
$patient->weight = $input['weight'];
$patient->address = $input['address'];
$patient->relatives = $input['parent'];
$patient->phone = $input['phone'];
$patient->save();
return Response::json(array('id' => $patient->id));
}