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


PHP Collection::find方法代码示例

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


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

示例1: listDieta

 public function listDieta(Request $req, $dietaList)
 {
     $dietaList = NULL;
     if (is_numeric($dietaList_id)) {
         $dietaList = Collection::find($dietaList_id);
         $dietaList->update($req->all());
     }
     return view('co.edu.javeriana.dieta_list', ['dietas' => $dietaList]);
 }
开发者ID:jpavlich,项目名称:anchurus-gen,代码行数:9,代码来源:DietaManagerController.php

示例2: testFindsIndexOfAnElement

 public function testFindsIndexOfAnElement()
 {
     $list = new Collection(\Cassandra::TYPE_VARINT);
     $list->add(new Varint('1'), new Varint('2'), new Varint('3'), new Varint('4'), new Varint('5'), new Varint('6'), new Varint('7'), new Varint('8'));
     $this->assertEquals(0, $list->find(new Varint('1')));
     $this->assertEquals(1, $list->find(new Varint('2')));
     $this->assertEquals(2, $list->find(new Varint('3')));
     $this->assertEquals(3, $list->find(new Varint('4')));
     $this->assertEquals(4, $list->find(new Varint('5')));
     $this->assertEquals(5, $list->find(new Varint('6')));
     $this->assertEquals(6, $list->find(new Varint('7')));
     $this->assertEquals(7, $list->find(new Varint('8')));
 }
开发者ID:Dylan1312,项目名称:php-driver,代码行数:13,代码来源:CollectionTest.php

示例3: testWhereText

 public function testWhereText()
 {
     $dbVersion = $this->collection->getDatabase()->getClient()->getDbVersion();
     if (version_compare($dbVersion, '2.6', '<=')) {
         return;
     }
     $this->collection->ensureFulltextIndex(array('subject', 'body'), array('subject' => 2, 'body' => 1));
     $this->collection->batchInsert(array(array('subject' => 'big brown dog', 'body' => 'walking on street'), array('subject' => 'little pony', 'body' => 'flying among rainbows')));
     $documents = $this->collection->find()->whereText('pony')->findAll();
     $this->assertEquals(1, count($documents));
     $document = current($documents);
     $this->assertEquals('little pony', $document->subject);
 }
开发者ID:Branik,项目名称:php-mongo,代码行数:13,代码来源:ExpressionTest.php

示例4: test_find

 function test_find()
 {
     //Arrange
     $name = "Hello Kitty";
     $name2 = "Pokemon";
     $test_collection = new Collection($name);
     $test_collection->save();
     $test_collection2 = new Collection($name2);
     $test_collection2->save();
     //Act
     $result = Collection::find($test_collection2->getId());
     //Assert
     $this->assertEquals($test_collection2, $result);
 }
开发者ID:Camolot,项目名称:inventory-PHP-databases,代码行数:14,代码来源:collectionTest.php

示例5: test_find

 function test_find()
 {
     //Arrange
     $thing = "Run the World";
     $thing2 = "20 20 Experience";
     $test_collection = new Collection($thing);
     $test_collection->save();
     $test_collection2 = new Collection($thing2);
     $test_collection2->save();
     //Act
     $id = $test_collection->getId();
     $result = Collection::find($id);
     //Assert
     $this->assertEquals($test_collection, $result);
 }
开发者ID:jmalo34,项目名称:Inventory_Collection,代码行数:15,代码来源:CollectionTest.php

示例6: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $collection = Collection::find($id);
     if (Auth::User()->id != $collection->user_id) {
         Flash::warning('You are not authorized to do that');
         return redirect()->route('home');
     }
     $collection->delete();
     Flash::info('Collection deleted!');
     return redirect()->route('collections.index');
 }
开发者ID:ecwilson123,项目名称:simplenote,代码行数:17,代码来源:CollectionsController.php

示例7: function

});
$app->post('/collections', function () use($app) {
    $collection = new Collection($_POST['name']);
    $collection->save();
    return $app['twig']->render('index.html.twig', array('collections' => Collection::getAll(), 'items' => Item::getAll()));
});
$app->get('/collection/{id}', function ($id) use($app) {
    $collection = Collection::find($id);
    return $app['twig']->render('collection.html.twig', array('collection' => $collection, 'items' => $collection->getItems()));
});
$app->post('/delete_collections', function () use($app) {
    Collection::deleteAll();
    return $app['twig']->render('index.html.twig', array('collections' => Collection::getAll(), 'items' => Item::getAll()));
});
$app->post('/collection/{id}/delete', function ($id) use($app) {
    $collection = Collection::find($id);
    $collection->delete();
    return $app['twig']->render('index.html.twig', array('collections' => Collection::getAll()));
});
$app->post('/items', function () use($app) {
    $item = new Item($_POST['name'], $_POST['collection_id']);
    $item->save();
    $collection = Collection::find($_POST['collection_id']);
    return $app['twig']->render('collection.html.twig', array('collection' => $collection, 'items' => $collection->getItems()));
});
$app->post('/collection/{id}/delete_items', function ($id) use($app) {
    $collection = Collection::find($id);
    $collection->deleteAssociatedItems();
    return $app['twig']->render('collection.html.twig', array('collection' => $collection, 'items' => []));
});
return $app;
开发者ID:ben-pritchard,项目名称:inventory-PHP-databases,代码行数:31,代码来源:app.php

示例8: getAll

 /**
  * Get results from the database as a cursor.
  *
  * @param string $collection_name name of the collection 
  * @param array $query a MongoDB query
  * @return MongoCursor
  */
 public function getAll($collection_name, $query = [])
 {
     if (!is_array($query)) {
         throw new \Exception("\$query must be an associative array of 'field => value' pairs");
     }
     $collection = new Collection($collection_name, true, $this);
     return $collection->find($query);
 }
开发者ID:BaguettePHP,项目名称:phactory,代码行数:15,代码来源:Phactory.php

示例9: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $collection = Collection::find($id);
     $collection->delete();
     return Redirect::route('collection.index');
 }
开发者ID:joisak,项目名称:phorrow,代码行数:12,代码来源:CollectionController.php

示例10: function

*/
Route::get('/', function () {
    $t = 1;
    $inventories = Inventory::all();
    return View::make('main/index')->with('inventories', $inventories)->with('t', $t);
});
Route::get('/albums', function () {
    $albums = Collection::all();
    return View::make('main/albums')->with('albums', $albums);
});
Route::get('/album/{albums}', function ($albums) {
    $albums = Collection::find($albums);
    return View::make('main/album')->with(array('albums' => $albums));
});
Route::get('/albums/{album}/image/{image}', function ($album, $image) {
    $album = Collection::find($album);
    $image = Inventory::find($image);
    return View::make('main/image')->with(array('album' => $album, 'image' => $image));
});
Route::get('/login', function () {
    return View::make('main/login');
});
//// ADMIN ROUTES BELOW
Route::resource('inventory', 'InventoryController');
Route::get('/users/{id}/pictures', function ($id) {
    $user = User::find($id);
    return View::make('inventories/mypics')->with('images', $user->pictures);
});
Route::resource('collection', 'CollectionController');
Route::controller('users', 'UsersController');
Route::post('comment/{id}', 'CommentController@store');
开发者ID:joisak,项目名称:phorrow,代码行数:31,代码来源:routes.php

示例11: testShouldReturnRecordAccordingToCriteria

 public function testShouldReturnRecordAccordingToCriteria()
 {
     $record1 = new Record(array('name' => 'A'));
     $record2 = new Record(array('name' => 'B'));
     $collection = new Collection(new Factory());
     $collection->insert($record1);
     $collection->insert($record2);
     $criteria = array('name' => 'B');
     $result = $collection->find($criteria);
     $this->assertSame($record2, $result);
 }
开发者ID:elevenone,项目名称:ArrayStorage,代码行数:11,代码来源:CollectionTest.php

示例12: collection_index

 public function collection_index()
 {
     $page = isset($_GET['page']) ? $_GET['page'] : 1;
     $per_page = 15;
     $collections_total = Collection::findAll();
     $collections = Collection::find(array('limit' => $per_page, 'offset' => ($page - 1) * $per_page));
     $pagination = new Pagination(array('base_url' => '/' . ADMIN_DIR . '/plugin/ecommerce/collection_index', 'total_rows' => count($collections_total), 'per_page' => $per_page, 'num_links' => 8, 'cur_page' => $page));
     $this->display('ecommerce/views/collections/index', array('collections' => $collections, 'pagination' => $pagination));
 }
开发者ID:shuhrat,项目名称:frog_ecommerce,代码行数:9,代码来源:EcommerceController.php


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