当前位置: 首页>>代码示例>>PHP>>正文


PHP Person::all方法代码示例

本文整理汇总了PHP中Person::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Person::all方法的具体用法?PHP Person::all怎么用?PHP Person::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Person的用法示例。


在下文中一共展示了Person::all方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public static function index()
 {
     // Haetaan kaikki henkilöt tietokannasta
     $people = Person::all();
     // Renderöidään views/people kansiossa sijaitseva tiedosto index.html muuttujan $people datalla
     View::make('User/index.html', array('people' => $people));
 }
开发者ID:juhapekkamoilanen,项目名称:Tsoha-Bootstrap,代码行数:7,代码来源:user_controller.php

示例2: testOptionsForAllPeople

 public function testOptionsForAllPeople()
 {
     $options = array('count' => 1);
     self::createTestPerson();
     self::createTestPerson();
     $people = Person::all($options);
     $this->assertSame(1, count($people));
 }
开发者ID:tjchambers,项目名称:blockscore-php,代码行数:8,代码来源:PersonTest.php

示例3: testInvalidOptionsErrorHandling

 public function testInvalidOptionsErrorHandling()
 {
     try {
         $options = "count: 5";
         $people = Person::all($options);
     } catch (Util\Exception $e) {
         $expected = 'invalid_options_error';
         $this->assertSame($expected, $e->type);
         $this->assertTrue($e instanceof Util\Exception);
     }
 }
开发者ID:nickparker39,项目名称:blockscore-php,代码行数:11,代码来源:ExceptionTest.php

示例4: index

 public function index()
 {
     //		$this->load->view('welcome_message');
     $persons = Person::all();
     foreach ($persons as $person) {
         echo "Name: " . $person->name . '<br><br>';
         $telephones = $person->telephone;
         foreach ($telephones as $telephone) {
             echo $telephone->telephone_type->type . ': ' . $telephone->telephone . '<br>';
         }
         echo '<hr>';
     }
 }
开发者ID:varz62,项目名称:codeigniter_3_eloquent_laravel_5,代码行数:13,代码来源:Welcome.php

示例5: count

$tito->reload();
echo "{$tito->name} has " . count($tito->orders) . " orders for: " . join(', ', ActiveRecord\collect($tito->orders, 'item_name')) . "\n\n";
// get all orders placed by Tito
foreach (Order::find_all_by_person_id($tito->id) as $order) {
    echo "Order #{$order->id} for {$order->item_name} (\${$order->price} + \${$order->tax} tax) ordered by " . $order->person->name . "\n";
    if (count($order->payments) > 0) {
        // display each payment for this order
        foreach ($order->payments as $payment) {
            echo "  payment #{$payment->id} of \${$payment->amount} by " . $payment->person->name . "\n";
        }
    } else {
        echo "  no payments\n";
    }
    echo "\n";
}
// display summary of all payments made by Tito and Jax
$conditions = array('conditions' => array('id IN(?)', array($tito->id, $jax->id)), 'order' => 'name desc');
foreach (Person::all($conditions) as $person) {
    $n = count($person->payments);
    $total = array_sum(ActiveRecord\collect($person->payments, 'amount'));
    echo "{$person->name} made {$n} payments for a total of \${$total}\n\n";
}
// using order has_many people through payments with options
// array('people', 'through' => 'payments', 'select' => 'people.*, payments.amount', 'conditions' => 'payments.amount < 200'));
// this means our people in the loop below also has the payment information since it is part of an inner join
// we will only see 2 of the people instead of 3 because 1 of the payments is greater than 200
$order = Order::find($pokemon->id);
echo "Order #{$order->id} for {$order->item_name} (\${$order->price} + \${$order->tax} tax)\n";
foreach ($order->people as $person) {
    echo "  payment of \${$person->amount} by " . $person->name . "\n";
}
开发者ID:visavi,项目名称:phpactiverecord,代码行数:31,代码来源:orders.php

示例6: index

 public function index()
 {
     $people = Person::all();
     return View::make('people.index', ['people' => $people]);
 }
开发者ID:andrewevans,项目名称:lana,代码行数:5,代码来源:PeopleController.php

示例7: d

$person->Firstname = "Kona";
$person->Age = "20";
$person->Sex = "F";
$creation = $person->Create();
// Update Person Info
$person->id = "4";
$person->Age = "32";
$saved = $person->Save();
// Find person
$person->id = "4";
$person->Find();
d($person->Firstname, "Person->Firstname");
d($person->Age, "Person->Age");
// Delete person
$person->id = "17";
$delete = $person->Delete();
// Get all persons
$persons = $person->all();
// Aggregates methods
d($person->max('age'), "Max person age");
d($person->min('age'), "Min person age");
d($person->sum('age'), "Sum persons age");
d($person->avg('age'), "Average persons age");
d($person->count('id'), "Count persons");
function d($v, $t)
{
    echo '<pre>';
    echo '<h1>' . $t . '</h1>';
    var_dump($v);
    echo '</pre>';
}
开发者ID:luokizz,项目名称:PHP-MySQL-PDO-Database-Class,代码行数:31,代码来源:index.php

示例8: index

 /**
  * Display a listing of people
  *
  * @return Response
  */
 public function index()
 {
     $people = Person::all();
     return View::make('people.index', compact('people'));
 }
开发者ID:C-a-p-s-t-o-n-e,项目名称:capstone.dev,代码行数:10,代码来源:PeopleController.php

示例9:

//
require_once '_common.php';
//
use Javanile\SchemaDB\Readable;
//
class Person extends Readable
{
    //
    public $id = self::PRIMARY_KEY;
    //
    public $name = "";
    public $surname = "";
    public $age = 0;
    public $address1 = 0;
    public $address2 = 0;
}
//
class Address extends Readable
{
    //
    public $id = self::PRIMARY_KEY;
    //
    public $name = "";
    public $latitude = 0;
    public $longitude = 0;
    public $city = "";
}
//
$Persons = Person::all(['name', 'address' => Address::join()]);
//
Person::dump($Persons);
开发者ID:javanile,项目名称:schemadb,代码行数:31,代码来源:all.php

示例10: testUpdateOnCollection

 function testUpdateOnCollection()
 {
     $person = new Person();
     $person->age = 23;
     $person->lessThan('age', 23)->update();
     $people = $person->find();
     $this->assertEquals(count($people), 4);
     $person = new Person();
     $person->age = 100;
     $person->all()->update();
     $people = $person->find();
     $this->assertEquals(count($people), 6);
 }
开发者ID:amitshukla30,项目名称:recess,代码行数:13,代码来源:ModelTest.php

示例11: function

<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    return view('welcome');
});
//Route::group(['prefix' => 'api/v1', 'middleware' => 'auth:api'], function () {
//    Route::post('/short', 'UrlMapperController@store');
//});
//
//Auth::guard('api')->user();
Route::get('/auth/login', function () {
    return "No tens Accés a l'API";
});
Route::group(['prefix' => 'api', 'middleware' => 'throttle:6,10'], function () {
    Route::get('people', function () {
        return Person::all();
    });
});
开发者ID:rogermelich,项目名称:tasksAPI,代码行数:28,代码来源:routes.php

示例12: Person

<?php

include_once "person_class.php";
if (count($_POST) > 0) {
    $newkid = new Person();
    $newkid->first_name = $_POST["first_name"];
    $newkid->last_name = $_POST["last_name"];
    $newkid->city = $_POST["city"];
    $newkid->state = $_POST["state"];
    $newkid->zip = $_POST["zip"];
    $newkid->email = $_POST["email"];
    $newkid->save();
}
$people = Person::all();
?>
<h1>Look at all my people</h1>
<table border="1">
    <thead>
        <tr><th>First</th>
            <th>Last</th>
            <th>City</th>
            <th>State</th>
            <th>Zip</th>
            <th>Email</th>
            <th>Action</th></tr>
    </thead>
    <tbody>
        <?php 
foreach ($people as $person) {
    echo "<tr>\n";
    echo "\t<td>{$person[1]}</td>\n";
开发者ID:kkmouser,项目名称:web_prog_week_6,代码行数:31,代码来源:people_app.php


注:本文中的Person::all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。