From 48a1e32a58a50b79cbed1f9926f0d22be78c452d Mon Sep 17 00:00:00 2001 From: Emanuil Rusev Date: Sun, 22 Feb 2015 21:53:50 +0200 Subject: [PATCH] improve readme --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e1bc534..fb66b62 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,8 @@ Read / update / count collections: ```php # read all users $Base->find('user')->read(); -# read the email addresses of the 20 most popular users -$Base->find('user')->limit(20)->orderDesc('reputation')->readFields('email'); +# read the user with the highest reputation +$Base->find('user')->limit(1)->orderDesc('reputation')->readRecord(); # update is_verified field of users #1 and #2 $Base->find('user')->whereIn('id', [1, 2])->update(['is_verified' => 1]); # count users that don't have a location @@ -49,10 +49,10 @@ Relationships: ```php # read all users that have a featured post $Base->find('user')->has('post')->whereEqual('post.is_featured', 1)->read(); -# read all posts that belong to user #123 ordered by title +# read all posts that belong to user #123 in an order based on title $Base->find('post')->belongsTo('user')->whereEqual('user.id', 123)->orderAsc('post.title')->readRecord(); -# read the titles of the last 5 posts that have a "php" tag -$Base->find('post')->hasAndBelongsTo('tag')->whereEqual('tag.name', 'php')->limit(5)->orderDesc('id')->readFields('title'); +# read the titles of the posts that have a "php" tag +$Base->find('post')->hasAndBelongsTo('tag')->whereEqual('tag.name', 'php')->readFields('title'); ``` Execute queries: