diff --git a/cache.md b/cache.md
index bed72847a9a..ced0eef4a66 100644
--- a/cache.md
+++ b/cache.md
@@ -2,6 +2,7 @@
- [Configuration](#configuration)
- [Cache Usage](#cache-usage)
+- [Increments & Decrements](#increments-and-decrements)
- [Database Cache](#database-cache)
@@ -18,6 +19,10 @@ The cache configuration file also contains various other options, which are docu
Cache::put('key', 'value', $minutes);
+**Storing An Item In The Cache If It Doesn't Exist**
+
+ Cache::add('key', 'value', $minutes);
+
**Retrieving An Item From The Cache**
$value = Cache::get('key');
@@ -52,6 +57,22 @@ Note that all items stored in the cache are serialized, so you are free to store
Cache::forget('key');
+
+
+All drivers except `file` and `database` support the `increment` and `decrement` operations:
+
+**Incrementing A Value**
+
+ Cache::increment('key');
+
+ Cache::increment('key', $amount);
+
+**Decrementing A Value**
+
+ Cache::decrement('key');
+
+ Cache::decrement('key', $amount);
+
## Database Cache
diff --git a/commands.md b/commands.md
index 3f4b9715fcc..b7c992d6894 100644
--- a/commands.md
+++ b/commands.md
@@ -95,6 +95,10 @@ You may also use the `ask` and `confirm` methods to prompt the user for input:
$name = $this->ask('What is your name?');
+**Asking The User For Secret Input**
+
+ $password = $this->secret('What is the password?');
+
**Asking The User For Confirmation**
if ($this->confirm('Do you wish to continue? [yes|no]'))
diff --git a/eloquent.md b/eloquent.md
index 71420b3dfbc..c06e00fd132 100644
--- a/eloquent.md
+++ b/eloquent.md
@@ -4,6 +4,7 @@
- [Basic Usage](#basic-usage)
- [Insert, Update, Delete](#insert-update-delete)
- [Timestamps](#timestamps)
+- [Query Scopes](#query-scopes)
- [Relationships](#relationships)
- [Eager Loading](#eager-loading)
- [Inserting Related Models](#inserting-related-models)
@@ -148,6 +149,26 @@ If you wish to customize the format of your timestamps, you may override the `fr
}
+
+## Query Scopes
+
+Scopes allow you to easily re-use query logic in your models. To define a scope, simply prefix a model method with `scope`:
+
+**Defining A Query Scope**
+
+ class User extends Eloquent {
+
+ public function scopePopular($query)
+ {
+ return $query->where('votes', '>', 100);
+ }
+
+ }
+
+**Utilizing A Query Scope**
+
+ $users = User::popular()->orderBy('created_at')->get();
+
## Relationships
diff --git a/lifecycle.md b/lifecycle.md
index 883a1a2c0a8..fce8d59dfb9 100644
--- a/lifecycle.md
+++ b/lifecycle.md
@@ -21,7 +21,7 @@ Of course, if you have other environments in addition to `local`, you may create
## Application Events
-You may also do pre and post request processing by registering `before` and `after` application events:
+You may also do pre and post request processing by registering `before`, `after`, `close`, `finish`, and `shutdown` application events:
**Registering Application Events**
@@ -30,7 +30,7 @@ You may also do pre and post request processing by registering `before` and `aft
//
});
- App::after(function()
+ App::after(function($request, $response)
{
//
});
diff --git a/packages.md b/packages.md
index ec733fb2071..5eed1e626d0 100644
--- a/packages.md
+++ b/packages.md
@@ -170,6 +170,8 @@ Some packages may have assets such as JavaScript, CSS, and images. However, we a
**Moving Package Assets To Public**
+ php artisan asset:publish
+
php artisan asset:publish vendor/package
If the package is still in the `workbench`, use the `--bench` directive:
diff --git a/queues.md b/queues.md
index b0bb7825371..ef51a42877e 100644
--- a/queues.md
+++ b/queues.md
@@ -9,7 +9,7 @@
The Laravel Queue component provides a unified API across a variety of different queue services. Queues allow you to defer the processing of a time consuming task, such as sending an e-mail, until a later time, thus drastically speeding up the web requests to your application.
-The queue configuration file is stored in `app/config/queue.php`. In this file you will find connection configurations for each of the queue drivers that are included with the framework, which includes a [Beanstalkd](http://kr.github.com/beanstalkd) and synchronous (for local use) driver.
+The queue configuration file is stored in `app/config/queue.php`. In this file you will find connection configurations for each of the queue drivers that are included with the framework, which includes a [Beanstalkd](http://kr.github.com/beanstalkd), [IronMQ](http://iron.io), [Amazon SQS](http://aws.amazon.com/sqs), and synchronous (for local use) driver.
## Basic Usage
@@ -85,7 +85,13 @@ You may also specify which queue connection the listener should utilize:
Note that once this task has started, it will continue to run until it is manually stopped. You may use a process monitor such as [Supervisor](http://supervisord.org/) to ensure that the queue listener does not stop running.
-To process the only the first job on the queue, you may use the `queue:work` command:
+You may also set the length of time (in seconds) each job should be allowed run:
+
+**Specifying The Job Timeout Parameter**
+
+ php artisan queue:listen --timeout=60
+
+To process only the first job on the queue, you may use the `queue:work` command:
**Processing The First Job On The Queue**
diff --git a/testing.md b/testing.md
index b60dbeb7483..a6a7aa21278 100644
--- a/testing.md
+++ b/testing.md
@@ -5,6 +5,7 @@
- [Test Environment](#test-environment)
- [Calling Routes From Tests](#calling-routes-from-tests)
- [Mocking Facades](#mocking-facades)
+- [Framework Assertions](#framework-assertions)
- [Helper Methods](#helper-methods)
@@ -105,6 +106,48 @@ We can mock the call to the `Event` class by using the `shouldReceive` method on
> **Note:** You should not mock the `Request` facade. Instead, pass the input you desire into the `call` method when running your test.
+
+## Framework Assertions
+
+Laravel ships with several `assert` methods to make testing a little easier:
+
+**Asserting Responses Are OK**
+
+ public function testMethod()
+ {
+ $this->call('GET', '/');
+
+ $this->assertRepsonseIsOk();
+ }
+
+**Asserting Responses Are Redirects**
+
+ $this->assertRedirectedTo('foo');
+
+ $this->assertRedirectedToRoute('route.name');
+
+ $this->assertRedirectedToAction('Controller@method');
+
+**Asserting A View Has Some Data**
+
+ public function testMethod()
+ {
+ $this->call('GET', '/');
+
+ $this->assertViewHas('name');
+ $this->assertViewHas('age', $value);
+ }
+
+**Asserting The Session Has Some Data**
+
+ public function testMethod()
+ {
+ $this->call('GET', '/');
+
+ $this->assertSessionHas('name');
+ $this->assertSessionHas('age', $value);
+ }
+
## Helper Methods