Skip to content

Commit

Permalink
Update Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
santigarcor committed Sep 29, 2017
1 parent 227c89d commit 7e792b0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Installation

1. In order to install Laratrust in your Laravel project, just run the `composer require` command from your terminal::

composer require "santigarcor/laratrust:4.0.*"
composer require "santigarcor/laratrust:5.0.*"

.. NOTE::
If you are using Laravel 5.5 you don't need to do steps 2 and 3.
Expand All @@ -16,7 +16,7 @@ Installation

'Laratrust' => Laratrust\LaratrustFacade::class,

4. Run the next command to publish all the configuration files::
4. Publish all the configuration files::

php artisan vendor:publish --tag="laratrust"

Expand Down
16 changes: 11 additions & 5 deletions docs/upgrade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,19 @@ In order to upgrade from Laratrust 4.0 to 5.0 you have to follow these steps:

4.4. Update the ``config/laratrust.php`` file with your old values.

4.5. Set the ``middleware.register`` value to false.
4.5. Set the ``middleware.register`` value to ``false``.

4.6. Set the ``teams_strict_check`` value to true if you are using teams.
4.6. Set the ``teams_strict_check`` value to ``true`` **only** if you are using teams.

5. Inside your ``Role``, ``Permission`` and ``Team`` models update the ``use`` statement from:

- ``use Laratrust\LaratrustRole`` to ``use Laratrust\Models\LaratrustRole``;
- ``use Laratrust\LaratrustPermission`` to ``use Laratrust\Models\LaratrustPermission``;
- ``use Laratrust\LaratrustTeam`` to ``use Laratrust\Models\LaratrustTeam``;

6. If you use the ability method and pass coma separated roles or permissions, change them to a pipe separated string::
6. If you use the ability method and pass coma separated roles or permissions, change them to a pipe separated string:

.. code-block:: php
// From
$user->ability('admin,owner', 'create-post,edit-user');
Expand All @@ -43,15 +45,19 @@ In order to upgrade from Laratrust 4.0 to 5.0 you have to follow these steps:
7. If you are using the ``Ownable`` interface, please update all the classes implementing it::

.. code-block:: php
// From
public function ownerKey() {}
// To
public function ownerKey($owner) {}
8. If you use teams and in your code you use the ``syncRoles`` and ``syncPermissions`` read the new :ref:`sync method behavior <new-sync-behavior>`.

9. Delete the ``LaratrustSeeder.php`` file and run ``php artisan laratrust:seeder``.
9. The ``cachedRoles`` and ``cachedPermissions`` methods now return an array when you have the ``laratrust.use_cache`` option set to ``true``. So if you use these methods, please check your code.

10. Delete the ``LaratrustSeeder.php`` file and run ``php artisan laratrust:seeder``.

10. Run ``composer dump-autoload``.
11. Run ``composer dump-autoload``.

Now you can use the 5.0 version without any problem.
2 changes: 1 addition & 1 deletion src/config/laratrust.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
| Defines if Laratrust will use Laravel's Cache to cache the roles and permissions.
|
*/
'use_cache' => false,
'use_cache' => true,

/*
|--------------------------------------------------------------------------
Expand Down

0 comments on commit 7e792b0

Please sign in to comment.