@@ -318,6 +318,10 @@ However, you may often only want to insert a new record into the intermediate ta
...
@@ -318,6 +318,10 @@ However, you may often only want to insert a new record into the intermediate ta
$user->roles()->attach($role_id);
$user->roles()->attach($role_id);
It's also possible to attach data for fields in the intermediate table (pivot table), to do this add a second array variable to the attach command containing the data you want to attach:
Alternatively, you can use the `sync` method, which accepts an array of IDs to "sync" with the intermediate table. After this operation is complete, only the IDs in the array will be on the intermediate table.
Alternatively, you can use the `sync` method, which accepts an array of IDs to "sync" with the intermediate table. After this operation is complete, only the IDs in the array will be on the intermediate table.
...
@@ -406,6 +410,28 @@ You may even eager load nested relationships. For example, let's assume our **Au
...
@@ -406,6 +410,28 @@ You may even eager load nested relationships. For example, let's assume our **Au
2. Extract the Laravel archive and upload the contents to your web server.
2. Extract the Laravel archive and upload the contents to your web server.
3. Set the value of the **key** option in the **config/application.php** file to a random, 32 character string.
3. Set the value of the **key** option in the **config/application.php** file to a random, 32 character string.
4. Navigate to your application in a web browser.
4. Verify that the `storage/views` directory is writable.
5. Navigate to your application in a web browser.
If all is well, you should see a pretty Laravel splash page. Get ready, there is lots more to learn!
If all is well, you should see a pretty Laravel splash page. Get ready, there is lots more to learn!
...
@@ -43,7 +44,7 @@ If you are having problems installing, try the following:
...
@@ -43,7 +44,7 @@ If you are having problems installing, try the following:
- Verify that your storage folder and the folders within are writable by your web server.
- Verify that your storage folder and the folders within are writable by your web server.
<aname="server-configuration"></a>
<aname="server-configuration"></a>
## Server Configuration: Why Public?
## Server Configuration
Like most web-development frameworks, Laravel is designed to protect your application code, bundles, and local storage by placing only files that are necessarily public in the web server's DocumentRoot. This prevents some types of server misconfiguration from making your code (including database passwords and other configuration data) accessible through the web server. It's best to be safe.
Like most web-development frameworks, Laravel is designed to protect your application code, bundles, and local storage by placing only files that are necessarily public in the web server's DocumentRoot. This prevents some types of server misconfiguration from making your code (including database passwords and other configuration data) accessible through the web server. It's best to be safe.
...
@@ -53,15 +54,12 @@ A very basic example of an Apache VirtualHost configuration for MySite might loo
...
@@ -53,15 +54,12 @@ A very basic example of an Apache VirtualHost configuration for MySite might loo
<VirtualHost *:80>
<VirtualHost *:80>
DocumentRoot /Users/JonSnow/Sites/MySite/public
DocumentRoot /Users/JonSnow/Sites/MySite/public
ServerName mysite.local
ServerName mysite.dev
</VirtualHost>
</VirtualHost>
Notice that while we installed to **/Users/JonSnow/Sites/MySite** our DocumentRoot points to **/Users/JonSnow/Sites/MySite/public**.
Notice that while we installed to **/Users/JonSnow/Sites/MySite** our DocumentRoot points to **/Users/JonSnow/Sites/MySite/public**.
Pointing the DocumentRoot to the public folder is a commonly used best-practice. However, you may need to use Laravel on a host that does not allow you to update your DocumentRoot. This is possible, but before resigning to this option it's best to contact your host and verify that you are unable to change your DocumentRoot to increase the security of your application.
While pointing the DocumentRoot to the public folder is a commonly used best-practice, it's possible that you may need to use Laravel on a host that does not allow you to update your DocumentRoot. A collection of algorithms to circumvent this need can be found [on the Laravel forums.](http://forums.laravel.com/viewtopic.php?id=1258)
More information about how to use the public folder can be found on the [Laravel Forums](http://forums.laravel.com/viewtopic.php?pid=10023#p10023).