Skip to content

Commit 97df77e

Browse files
committed
Added anchors for sub-heading to make linking to specific portions of the docs easier.
1 parent 0aa723a commit 97df77e

30 files changed

+349
-7
lines changed

artisan.md

+4
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,28 @@ Artisan is the name of the command-line interface included with Laravel. It prov
1313

1414
To view a list of all available Artisan commands, you may use the `list` command:
1515

16+
<a name="listing-all-available-commands"></a>
1617
**Listing All Available Commands**
1718

1819
php artisan list
1920

2021
Every command also includes a "help" screen which displays and describes the command's available arguments and options. To view a help screen, simply precede the name of the command with `help`:
2122

23+
<a name="viewing-the-help-screen-for-a-command"></a>
2224
**Viewing The Help Screen For A Command**
2325

2426
php artisan help migrate
2527

2628
You may specify the configuration environment that should be used while running a command using the `--env` switch:
2729

30+
<a name="specifying-the-configuration-environment"></a>
2831
**Specifying The Configuration Environment**
2932

3033
php artisan migrate --env=local
3134

3235
You may also view the current version of your Laravel installation using the `--version` option:
3336

37+
<a name="displaying-your-current-laravel-version"></a>
3438
**Displaying Your Current Laravel Version**
3539

3640
php artisan --version

cache.md

+13
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,46 @@
99
<a name="configuration"></a>
1010
## Configuration
1111

12+
<a name="Foo Bar Baz">
13+
1214
Laravel provides a unified API for various caching systems. The cache configuration is located at `app/config/cache.php`. In this file you may specify which cache driver you would like used by default throughout your application. Laravel supports popular caching backends like [Memcached](http://memcached.org) and [Redis](http://redis.io) out of the box.
1315

1416
The cache configuration file also contains various other options, which are documented within the file, so make sure to read over these options. By default, Laravel is configured to use the `file` cache driver, which stores the serialized, cached objects in the filesystem. For larger applications, it is recommended that you use an in-memory cache such as Memcached or APC.
1517

1618
<a name="cache-usage"></a>
1719
## Cache Usage
1820

21+
<a name="storing-an-item-in-the-cache"></a>
1922
**Storing An Item In The Cache**
2023

2124
Cache::put('key', 'value', $minutes);
2225

26+
<a name="storing-an-item-in-the-cache-if-it-doesn't-exist"></a>
2327
**Storing An Item In The Cache If It Doesn't Exist**
2428

2529
Cache::add('key', 'value', $minutes);
2630

31+
<a name="checking-for-existence-in-cache"></a>
2732
**Checking For Existence In Cache**
2833

2934
if (Cache::has('key'))
3035
{
3136
//
3237
}
3338

39+
<a name="retrieving-an-item-from-the-cache"></a>
3440
**Retrieving An Item From The Cache**
3541

3642
$value = Cache::get('key');
3743

44+
<a name="retrieving-an-item-or-returning-a-default-value"></a>
3845
**Retrieving An Item Or Returning A Default Value**
3946

4047
$value = Cache::get('key', 'default');
4148

4249
$value = Cache::get('key', function() { return 'default'; });
4350

51+
<a name="storing-an-item-in-the-cache-permanently"></a>
4452
**Storing An Item In The Cache Permanently**
4553

4654
Cache::forever('key', 'value');
@@ -61,6 +69,7 @@ You may also combine the `remember` and `forever` methods:
6169

6270
Note that all items stored in the cache are serialized, so you are free to store any type of data.
6371

72+
<a name="removing-an-item-from-the-cache"></a>
6473
**Removing An Item From The Cache**
6574

6675
Cache::forget('key');
@@ -70,12 +79,14 @@ Note that all items stored in the cache are serialized, so you are free to store
7079

7180
All drivers except `file` and `database` support the `increment` and `decrement` operations:
7281

82+
<a name="incrementing-a-value"></a>
7383
**Incrementing A Value**
7484

7585
Cache::increment('key');
7686

7787
Cache::increment('key', $amount);
7888

89+
<a name="decrementing-a-value"></a>
7990
**Decrementing A Value**
8091

8192
Cache::decrement('key');
@@ -89,6 +100,7 @@ All drivers except `file` and `database` support the `increment` and `decrement`
89100
90101
Cache sections allow you to group related items in the cache, and then flush the entire section. To access a section, use the `section` method:
91102

103+
<a name="accessing-a-cache-section"></a>
92104
**Accessing A Cache Section**
93105

94106
Cache::section('people')->put('John', $john);
@@ -97,6 +109,7 @@ Cache sections allow you to group related items in the cache, and then flush the
97109

98110
You may also access cached items from the section, as well as use the other cache methods such as `increment` and `decrement`:
99111

112+
<a name="accessing-items-in-a-cache-section"></a>
100113
**Accessing Items In A Cache Section**
101114

102115
$anne = Cache::section('people')->get('Anne');

commands.md

+13
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ In addition to the commands provided with Artisan, you may also build your own c
1717

1818
To create a new command, you may use the `command:make` Artisan command, which will generate a command stub to help you get started:
1919

20+
<a name="generate-a-new-command-class"></a>
2021
**Generate A New Command Class**
2122

2223
php artisan command:make FooCommand
@@ -59,18 +60,22 @@ The `VALUE_NONE` option indicates that the option is simply used as a "switch":
5960

6061
While your command is executing, you will obviously need to access the values for the arguments and options accepted by your application. To do so, you may use the `argument` and `option` methods:
6162

63+
<a name="retrieving-the-value-of-a-command-argument"></a>
6264
**Retrieving The Value Of A Command Argument**
6365

6466
$value = $this->argument('name');
6567

68+
<a name="retrieving-all-arguments"></a>
6669
**Retrieving All Arguments**
6770

6871
$arguments = $this->argument();
6972

73+
<a name="retrieving-the-value-of-a-command-option"></a>
7074
**Retrieving The Value Of A Command Option**
7175

7276
$value = $this->option('name');
7377

78+
<a name="retrieving-all-options"></a>
7479
**Retrieving All Options**
7580

7681
$options = $this->option();
@@ -79,10 +84,12 @@ While your command is executing, you will obviously need to access the values fo
7984

8085
To send output to the console, you may use the `info`, `comment`, `question` and `error` methods. Each of these methods will use the appropriate ANSI colors for their purpose.
8186

87+
<a name="sending-information-to-the-console"></a>
8288
**Sending Information To The Console**
8389

8490
$this->info('Display this on the screen');
8591

92+
<a name="sending-an-error-message-to-the-console"></a>
8693
**Sending An Error Message To The Console**
8794

8895
$this->error('Something went wrong!');
@@ -91,14 +98,17 @@ To send output to the console, you may use the `info`, `comment`, `question` and
9198

9299
You may also use the `ask` and `confirm` methods to prompt the user for input:
93100

101+
<a name="asking-the-user-for-input"></a>
94102
**Asking The User For Input**
95103

96104
$name = $this->ask('What is your name?');
97105

106+
<a name="asking-the-user-for-secret-input"></a>
98107
**Asking The User For Secret Input**
99108

100109
$password = $this->secret('What is the password?');
101110

111+
<a name="asking-the-user-for-confirmation"></a>
102112
**Asking The User For Confirmation**
103113

104114
if ($this->confirm('Do you wish to continue? [yes|no]'))
@@ -115,12 +125,14 @@ You may also specify a default value to the `confirm` method, which should be `t
115125

116126
Once your command is finished, you need to register it with Artisan so it will be available for use. This is typically done in the `app/start/artisan.php` file. Within this file, you may use the `Artisan::add` method to register the command:
117127

128+
<a name="registering-an-artisan-command"></a>
118129
**Registering An Artisan Command**
119130

120131
Artisan::add(new CustomCommand);
121132

122133
If your command is registered in the application [IoC container](/docs/ioc), you may use the `Artisan::resolve` method to make it available to Artisan:
123134

135+
<a name="registering-a-command-that-is-in-the-ioc-container"></a>
124136
**Registering A Command That Is In The IoC Container**
125137

126138
Artisan::resolve('binding.name');
@@ -130,6 +142,7 @@ If your command is registered in the application [IoC container](/docs/ioc), you
130142

131143
Sometimes you may wish to call other commands from your command. You may do so using the `call` method:
132144

145+
<a name="calling-another-command"></a>
133146
**Calling Another Command**
134147

135148
$this->call('command.name', array('argument' => 'foo', '--option' => 'bar'));

configuration.md

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ All of the configuration files for the Laravel framework are stored in the `app/
1111

1212
Sometimes you may need to access configuration values at run-time. You may do so using the `Config` class:
1313

14+
<a name="accessing-a-configuration-value"></a>
1415
**Accessing A Configuration Value**
1516

1617
Config::get('app.timezone');
@@ -21,6 +22,7 @@ You may also specify a default value to return if the configuration option does
2122

2223
Notice that "dot" style syntax may be used to access values in the various files. You may also set configuration values at run-time:
2324

25+
<a name="setting-a-configuration-value"></a>
2426
**Setting A Configuration Value**
2527

2628
Config::set('database.default', 'sqlite');
@@ -63,6 +65,7 @@ You may also pass a `Closure` to the `detectEnvironment` method, allowing you to
6365

6466
You may access the current application environment via the `environment` method:
6567

68+
<a name="accessing-the-current-application-environment"></a>
6669
**Accessing The Current Application Environment**
6770

6871
$environment = App::environment();

controllers.md

+3
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ You may also specify controller filters inline using a Closure:
9999

100100
Laravel allows you to easily define a single route to handle every action in a controller using simple, REST naming conventions. First, define the route using the `Route::controller` method:
101101

102+
<a name="defining-a-restful-controller"></a>
102103
**Defining A RESTful Controller**
103104

104105
Route::controller('users', 'UserController');
@@ -140,6 +141,7 @@ Now we can register a resourceful route to the controller:
140141

141142
This single route declaration creates multiple routes to handle a variety of RESTful actions on the photo resource. Likewise, the generated controller will already have stubbed methods for each of these actions with notes informing you which URIs and verbs they handle.
142143

144+
<a name="actions-handled-by-resource-controller"></a>
143145
**Actions Handled By Resource Controller**
144146

145147
Verb | Path | Action | Route Name
@@ -168,6 +170,7 @@ And, you may also specify a subset of actions to handle on the route:
168170

169171
A catch-all method may be defined which will be called when no other matching method is found on a given controller. The method should be named `missingMethod`, and receives the parameter array for the request as its only argument:
170172

173+
<a name="defining-a-catch-all-method"></a>
171174
**Defining A Catch-All Method**
172175

173176
public function missingMethod($parameters)

database.md

+6
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,38 @@ Currently Laravel supports four database systems: MySQL, Postgres, SQLite, and S
1818

1919
Once you have configured your database connection, you may run queries using the `DB` class.
2020

21+
<a name="running-a-select-query"></a>
2122
**Running A Select Query**
2223

2324
$results = DB::select('select * from users where id = ?', array(1));
2425

2526
The `select` method will always return an `array` of results.
2627

28+
<a name="running-an-insert-statement"></a>
2729
**Running An Insert Statement**
2830

2931
DB::insert('insert into users (id, name) values (?, ?)', array(1, 'Dayle'));
3032

33+
<a name="running-an-update-statement"></a>
3134
**Running An Update Statement**
3235

3336
DB::update('update users set votes = 100 where name = ?', array('John'));
3437

38+
<a name="running-a-delete-statement"></a>
3539
**Running A Delete Statement**
3640

3741
DB::delete('delete from users');
3842

3943
> **Note:** The `update` and `delete` statements return the number of rows affected by the operation.
4044
45+
<a name="running-a-general-statement"></a>
4146
**Running A General Statement**
4247

4348
DB::statement('drop table users');
4449

4550
You may listen for query events using the `DB::listen` method:
4651

52+
<a name="listening-for-query-events"></a>
4753
**Listening For Query Events**
4854

4955
DB::listen(function($sql, $bindings, $time)

0 commit comments

Comments
 (0)