dev-master
9999999-devStart point for new projects
MIT
The Requires
The Development Requires
laravel framework
v1.0
1.0.0.0The Laravel Framework.
MIT
The Requires
The Development Requires
laravel framework
Wallogit.com
2017 © Pedro PelĂĄez
Start point for new projects
Start point for newer projects. Build with Laravel and Vue :ok_hand:, (*1)
To get going you only need to do the following:, (*2)
``` sh $ composer install $ cp .env.example .env $ php artisan key:generate $ php artisan migrate && php artisan db:seed $ npm install $ npm run dev $ ./vendor/bin/phpunit $ php artisan serve, (*3)
# Usage #### Seeds All your routes (resources/permissions) must me mapped in the database, so that the permission control can work properly. To create new resources and their permissions you have to register them in `ResourcesPermissionsSeeder` class. This is simply done by: ``` php $this->createNewResource(['users' => 'User management'], [ 'index' => 'Users list', 'create' => 'Creates new user', 'edit' => 'Update user info', 'delete' => 'Delete a user', 'details' => 'Manage user profiles' ]);
Note: Tatooine only accept routes in the
resource/permission/{parameters}format., (*4)Note: You can change the method description, Tatooine will update it info. You can also delete a permission, just remove it from the permissions
array., (*5)
To run the seeder you can use the command:
$ php artisan resource:run, (*6)
Tatooine provides a flexible way to design your routes. You can easily set in your .env like the following:, (*7)
BASE_ROUTE='tatooine' //Used as the first part of your route. Ex.: yoursystem.com/tatooine/home MIX_BASE_ROUTE='security' //This one is used by JS to append on AJAX calls CUSTOM_HOME='home' //Where the application goes when is accessed and after login
Now Tatooine knows how to map your routes., (*8)
There is a Helper class (in app/Helper.php) where are two useful global methods
* baseUrl: Retrieves your application full url with your base_route(Ex.: yoursystem.com/tatooine). This function have an optional parameter $complement, wich can be used to complement your base route
(Ex.: yoursystem.com/tatooine/users/create), (*9)
Tatooine comes with three super classes: Model, Repository and Request. The application use them instead of the native classes of Laravel for aditional funcionalities. They live on Core namespace(Ex.:Core\Model), (*10)
$filterColumns array containing the "filterable" columns and the corresponding operator for the filter to use. This array must be defined in your Model classes like bellow:
php
$filterColumns = [
'usr_name' => 'like',
'usr_enabled' => '='
]
Eloquent\Model method, the Repository class will pass the call to its Model instance (unless a method with the same name is defined in it)listModel method in combination with DataGrid component(described bellow).Tatooine comes shipped with two reusable components, Action and DataGrid., (*11)
<action></action>, (*12)
This component can render a button/anchor dynamically, based on the user permissions. The usage is simle as below:
``` html
Action props:
* **action**: The url to the action. In an anchor it will be an `href`. Action will use it to check permissions
* **aclass**: Will aply `class` to the anchor/button
* **icon(optional)**: Will set an icon to the button
* **type**: Action component will use this to determine if it will render a anchor or a button. Possible values are: 'anchor' and 'button'
Action events:
* **btn-clicked**: When action type is 'button', the Action component attach a btn-clicked event to the `click` native event so that you can control what it will do. Then you can listen to the event like below:
``` js
doSomethingWithThis (url) {
//Whatever you want
}
Note: The component has a
slotinside the anchor/button tag. So that you can pass additional info inside the component, (*14)
<data-grid></data-grid>, (*15)
This component renders a paginated grid, with filter options. Also, you can define actions for each row. The usage:, (*16)
``` html <data-grid url="{{baseUrl('/users/list')}}" primary-key="usr_id" :user-fields="{usr_name: 'User', usr_email: 'E-mail', usr_username: 'Username', usr_enabled: 'Status'}" :user-filters="{ usr_name: {type: 'text', size: 4}, usr_enabled: {type: 'select', size: 3, options: {1: 'Enabled', 0: 'Disabled'}} }" :actions="[ {method: 'edit', url: 'users/edit'}, {method: 'delete', url: 'users/delete'}, {method: 'details', url: 'users/details'} ]" :mutators="{usr_enabled: {0: 'Disabled', 1: 'Enabled'}}", (*17)
DataGrid props: * **url**: You API to retrieve the data to DataGrid. * **primary-key**: This will be used in the grid actions as a parameter, must be a present field on the data retrieved from the server. * **user-fields**: The fields that the DataGrid will show. Has the `{field_name: 'fieldTitle'}` format. * **actions**: You may define three type of actions: edit, delete and details. DataGrid will render delete action as a button and the other two will be anchors. In each action you must pass the url for the action. The DataGrid will pass the `primaryKey` as the parameter for each url. * **user-filters**: To setup the filters you have to pass an object with info for each field. You must pass the type of the filter and it's size(just a number between 1 and 12, DataGrid will automatically convert to bootstrap grids classes). The type can be 'text', 'number' or 'select'. For 'select' type will have to define also its options, like bellow:js options: {1: 'Option one', 2: 'Option 2'} ```, (*18)Note 1: The object key is used as the filter value, (*19)
Note 2: This filter feature will be improved to allow other input types(such as 'checkbox' and 'radio, (*20)
{usr_enabled: {0: 'Disabled', 1: 'Enabled'}}
Start point for new projects
MIT
laravel framework
The Laravel Framework.
MIT
laravel framework