Skip to content

Commit

Permalink
Update docs and add issue template
Browse files Browse the repository at this point in the history
  • Loading branch information
santigarcor committed Jul 17, 2017
1 parent 6688670 commit becbce2
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitattributes
@@ -1,5 +1,6 @@
* text=auto

/.github export-ignore
/docs export-ignore
/tests export-ignore
.gitattributes export-ignore
Expand Down
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE.md
@@ -0,0 +1,22 @@
<!--
Before posting this issue, please read the troubleshooting section in the docs (http://laratrust.readthedocs.io/en/4.0/troubleshooting.html).
If you have a question, you don't need to provide any data shown below.
Important:
If you made changes to your database directly and the changes aren't reflected in your app, please clear your application cache.
-->

- Laravel Version: #.#.#
- Laratrust Version: #.#.#

### Description:


### Steps To Reproduce:

<!--
If you provide all the required information the issue will be easier to address.
-->
45 changes: 24 additions & 21 deletions docs/troubleshooting.rst
Expand Up @@ -3,25 +3,6 @@
Troubleshooting
===============

If you encounter an error when doing the migration that looks like::

SQLSTATE[HY000]: General error: 1005 Can't create table 'laravelbootstrapstarter.#sql-42c_f8' (errno: 150)
(SQL: alter table `role_user` add constraint role_user_user_id_foreign foreign key (`user_id`)
references `users` (`id`)) (Bindings: array ())

Then it is likely that the ``id`` column in your user table does not match the ``user_id`` column in ``role_user``.
Make sure both are ``INT(10)``.

---

When trying to use the LaratrustUserTrait methods, you encounter the error which looks like::

Class name must be a valid object or a string

Then probably you do not have published Laratrust assets or something went wrong when you did it.
First of all check that you have the ``laratrust.php`` file in your ``app/config`` directory.
If you don't, then try ``php artisan vendor:publish`` and, if it does not appear, manually copy the ``/vendor/santigarcor/laratrust/src/config/config.php`` file in your config directory and rename it ``laratrust.php``.

---

If you make changes directly to the Laratrust tables and when you run your code the changes are not reflected, please clear your application cache using::
Expand All @@ -32,7 +13,7 @@ Remember that Laratrust uses cache in the roles and permissions checks.

---

If you want to use the ``Authorizable`` trait yo have to do:
If you want to use the ``Authorizable`` trait you have to do:

.. code-block:: php
Expand All @@ -46,4 +27,26 @@ And then replace all the uses of ``can`` with ``hasPermission`` or ``isAbleTo``.
.. NOTE::
If you use the ``Laratrust::can`` facade method you don't have to change this method because it calls the ``hasPermission`` method.

---
---

If you encounter an error when doing the migration that looks like::

SQLSTATE[HY000]: General error: 1005 Can't create table 'laravelbootstrapstarter.#sql-42c_f8' (errno: 150)
(SQL: alter table `role_user` add constraint role_user_user_id_foreign foreign key (`user_id`)
references `users` (`id`)) (Bindings: array ())

Then it is likely that the ``id`` column in your user table does not match the ``user_id`` column in ``role_user``.
Make sure both are ``INT(10)``.

---

When trying to use the LaratrustUserTrait methods, you encounter the error which looks like::

Class name must be a valid object or a string

Then probably you do not have published Laratrust assets or something went wrong when you did it.
First of all check that you have the ``laratrust.php`` file in your ``app/config`` directory.
If you don't, then try ``php artisan vendor:publish`` and, if it does not appear, manually copy the ``/vendor/santigarcor/laratrust/src/config/config.php`` file in your config directory and rename it ``laratrust.php``.

---

0 comments on commit becbce2

Please sign in to comment.