Skip to content

Commit 8448efc

Browse files
committed
Add laravelcollective/html dependency, update documentation
1 parent 10c213d commit 8448efc

File tree

3 files changed

+10
-82
lines changed

3 files changed

+10
-82
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Change Log
22
[Package Checklist](http://phppackagechecklist.com)
33

4+
## [0.1.8] - 29 Sep 2015
5+
### Added
6+
- "laravelcollective/html" as a package dependency.
7+
- moved documentation to https://governor.forlaravel.com.
8+
49
## [0.1.0] - 1 Sep 2015
510
### Added
611
- Commit initial code, derived from the Bones-Keeper package.

README.md

+3-81
Original file line numberDiff line numberDiff line change
@@ -3,91 +3,13 @@
33

44
![governor for laravel](https://cloud.githubusercontent.com/assets/1791050/9620997/05b36650-50d6-11e5-864b-f15bd9622d08.jpg)
55

6-
## Overview
7-
### Goal
6+
## Goal
87
Provide a simple method of managing ACL in a Laravel application built on the Laravel Authorization functionality.
98
By leveraging Laravel's native Authorization functionality there is no additional learning or implementation curve. All
109
you need to know is Laravel, and you will know how to use Governor for Laravel.
1110

12-
### Reasoning
13-
I was looking for a straight-forward approach to ACL management that didn't require extensive customization,
14-
configuration, or even project rewrites. The following criteria shaped the development of this package:
15-
- Provide drop-in capability, so you can equally add it to existing or new Laravel projects without issues.
16-
- Allow granular access management, yet keep it simple to use.
17-
- Provide an administrative front-end out-of-the box.
18-
19-
### Considerations
20-
#### User Requirements
21-
- You must have at least 1 (one) user in your users table. The user with the lowest ID will become your admin by default.
22-
This can be changed after the installation, of course.
23-
24-
#### Tables
25-
You must add a `created_by` column to each of your tables. I purposefully chose not to write a 'magical' migration that
26-
would do all this for you, as that could lead to problems. However, I have added such a migration at the end to give you
27-
a solid starting point.
28-
29-
#### User Model
30-
Your user model (most often `User.php`) should implement the Governable and Authorizable traits:
31-
```php
32-
<?php namespace App;
33-
34-
use GeneaLabs\LaravelGovernor\Governable;
35-
use Illuminate\Auth\Authenticatable;
36-
use Illuminate\Auth\Passwords\CanResetPassword;
37-
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
38-
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
39-
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
40-
use Illuminate\Database\Eloquent\Model;
41-
use Illuminate\Foundation\Auth\Access\Authorizable;
42-
43-
class User extends Model implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract
44-
{
45-
use Authenticatable;
46-
use Authorizable;
47-
use CanResetPassword;
48-
use Governable;
49-
50-
// [...]
51-
}
52-
```
53-
54-
#### Models
55-
The `create` methods in your models will automatically add the created_by user ID. To prevent this, add the following to
56-
your models that do not have a `created_by` column in their table:
57-
```php
58-
protected $isGoverned = false;
59-
```
60-
61-
#### Routes
62-
This package adds multiple routes under `genealabs/laravel-governor`. Please verify that these don't collide with any of
63-
your existing routes.
64-
65-
#### Policies
66-
Your policy classes must extend `GeneaLabs\LaravelGovernor\Policies\LaravelGovernorPolicy`, and call the
67-
`validatePermissions` method. Please see the example policy class below. As you can see, all your policies are very
68-
straightforward, clean, and easy to understand. Governor and Laravel take care of all the dirty work for you.
69-
70-
## Features
71-
Governor for Laravel takes full advantage of the Authorization functionality added to Laravel 5.1.12 and provides full
72-
User/Roles management. It lets you specify the policies using the native Authorization mechanisms, and lets you
73-
granularly manage user access to the various parts of your system.
74-
75-
### Entities
76-
![screen shot 2015-09-01 at 18 46 40](https://cloud.githubusercontent.com/assets/1791050/9621341/25faf32a-50da-11e5-9c4c-cb1b8ac0c0e0.png)
77-
You define a list of entities, named after your Policy classes. This is not a requirement, but helps keep things organized.
78-
79-
### Roles
80-
![screen shot 2015-09-01 at 18 47 09](https://cloud.githubusercontent.com/assets/1791050/9621338/21878380-50da-11e5-86bc-e2c0cd11635a.png)
81-
Roles are basically your user-groups. Two roles are created out of the box (these cannot be removed):
82-
- Superadmin: is set up with the user with the lowest ID by default. You can add more users as necessary.
83-
- Members: all users are by default members. You cannot remove users from the Members group.
84-
85-
![screen shot 2015-09-02 at 10 28 52](https://cloud.githubusercontent.com/assets/1791050/9638813/77f0d928-515d-11e5-95c8-ab00289a5fad.png)
86-
Editing each role will let you specify granular access to each policy.
87-
88-
### Assignments
89-
![screen shot 2015-09-01 at 18 48 18](https://cloud.githubusercontent.com/assets/1791050/9621369/73eed088-50da-11e5-8bd1-72c61edd3548.jpg)
90-
Assignments tie users to roles; this is where you add and remove users to and from roles.
11+
## Documentation
12+
Please see https://governor.forlaravel.com for complete documentation.
9113

9214
## Installation
9315
```sh

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"require": {
1212
"php": ">=5.5.9",
1313
"genealabs/bones-macros": "^0.2.33",
14-
"illuminate/support": "^5.1"
14+
"illuminate/support": "^5.1",
15+
"laravelcollective/html": "^5.1"
1516
},
1617
"require-dev": {
1718
"orchestra/testbench": "~3.1",

0 commit comments

Comments
 (0)