2017 © Pedro Peláez
 

library larabackend

Backend for laravel

image

flo5581/larabackend

Backend for laravel

  • Thursday, December 29, 2016
  • by flo5581
  • Repository
  • 1 Watchers
  • 1 Stars
  • 57 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 14 Versions
  • 0 % Grown

The README.md

larabackend

Installation

Add packages to composer.json:

"flostone/larahelpers" : "1.0.*", (*1)

Add to Kernel.php in App\Console:, (*2)

\FloStone\Backend\Commands\AdminInstallation::class, (*3)

Register Service Provider:

Flo\Backend\BackendProvider::class
Flo5581\Larahelpers\BladeExtensions::class
Maatwebsite\Excel\ExcelServiceProvider::class
, (*4)

Add Facades

'Excel' => Maatwebsite\Excel\Facades\Excel::class, (*5)

Execute:, (*6)

php artisan admin:install, (*7)

This will work with Laravel 5.0.* however you need to use strings instead of ::class
Example:
'\FloStone\Backend\Commands\AdminInstallation', (*8)

Basic Usage

Before you do anything: Create a controller that extends, (*9)

FloStone\Backend\Controllers\AdminController, (*10)

and add the controller to your routes.php using, (*11)

Route::controller('admin', 'YourController'), (*12)

or, (*13)

controller('admin', 'YourController'), (*14)

Remember to protected the controller with a middleware but when you do that You need to call the parent constructor as well, (*15)

public function __constrcut() {
parent::__construct();
``$this->middleware('admin);<br>}`, (*16)

First you need to tell the Backend what controller methods should be displayed in the menu A key indicates the name displayed in the menu, the value tells the controller method, (*17)

public static $displayed_actions = ['Index' => 'getIndex'], (*18)

To create a view that displays a model you have to use the view method of the parent controller. Don't use the laravel view method! just pass through the model you wish to use., (*19)

public function getIndex()
{
$this->view(Model::class);
}, (*20)

To add parts to the view like a table where the content should be displayed you need to use the addTable method, (*21)

$this->view(Model::class)->addTable(), (*22)

This will automatically print out the data of the model in the table. Additionally you can provide a Collection of custom data to the table as the first parameter and you can decide if the content should be editable using the second parameter, the default value is true, (*23)

$this->view(Model::class)->addTable($custom_data, true), (*24)

Finally call the render method to make everything work, (*25)

$this->view(Model::class)->addTable()->render(), (*26)

To define which columns of your model should be displayed inside the table you have to add, (*27)

public static $displayed_columns = ['email', 'name'], (*28)

to your model and put in the fields that should be displayed To define the columns the can be edited by an admin, you need to add, (*29)

public static $editable_columns = ['email' => []], (*30)

Additionally you should can add properties to that field like setting a label that is shown as headline in the table, (*31)

public static $editable_columns = ['email' => ['label' => 'E-Mail']], (*32)

Keep in mind that not having this variable or having it empty will cause an error, (*33)

Add an export field by using addExport as method Pass through the filetype as first parameter, (*34)

$this->view(Model::class)->addTable()->addExport('xls')->render(), (*35)

Model Definitions

Here is a list of all Model definitions and what they do:, (*36)

1

public static $display_columns = ['column' => [(options)]]
Field MUST be set!
An array of all displayed columns in the backend table
Options:
'label' => 'Name of Column'
'relation' => [(properties)]
Relation Properties:
'method' => 'nameofrelationmethod'
'display' => 'displayedfieldofrelatedobject', (*37)

2

public static $editable_columns = ['column' => [(options)]]
Field MUST be set!
An array of columns that should be editable
Options:
'label' => 'Name of Column'
'type' => 'Type of Field'
List of field types:
'string'
'text'
'textarea'
'integer'
'int'
'password'
'pass'
'checkbox'
'boolean'
'select'
'selectbox'
'enum'
'file'
'image'
, (*38)

3

public static $export_fields = ['column' => [(options)]]
Field CAN be set
An array of fields that should be exported, exports all columns AND relations by default
Options:
'label' => 'Name of Column'
'relation' => [(properties)]
Relation Properties:
'method' => 'nameofrelationmethod'
'display' => 'displayedfieldofrelatedobject', (*39)

The Versions

29/12 2016

dev-master

9999999-dev

Backend for laravel

  Sources   Download

The Requires

 

by Avatar flo5581

29/12 2016

1.1.7

1.1.7.0

Backend for laravel

  Sources   Download

The Requires

 

by Avatar flo5581

05/07 2016

1.1.6

1.1.6.0

Backend for laravel

  Sources   Download

The Requires

 

by Avatar flo5581

23/02 2016

1.1.5

1.1.5.0

Backend for laravel

  Sources   Download

The Requires

 

by Avatar flo5581

22/02 2016

1.1.4

1.1.4.0

Backend for laravel

  Sources   Download

The Requires

 

by Avatar flo5581

11/01 2016

1.1.3

1.1.3.0

Backend for laravel

  Sources   Download

The Requires

 

by Avatar flo5581

11/01 2016

1.1.2

1.1.2.0

Backend for laravel

  Sources   Download

The Requires

 

by Avatar flo5581

01/12 2015

1.1.1

1.1.1.0

Backend for laravel

  Sources   Download

The Requires

 

by Avatar flo5581

17/07 2015

1.0.5

1.0.5.0

Backend for laravel

  Sources   Download

The Requires

 

by Avatar flo5581

16/07 2015

1.0.4

1.0.4.0

Backend for laravel

  Sources   Download

The Requires

 

by Avatar flo5581

15/07 2015

1.0.3

1.0.3.0

Backend for laravel

  Sources   Download

The Requires

 

by Avatar flo5581

15/07 2015

1.0.2

1.0.2.0

Backend for laravel

  Sources   Download

The Requires

 

by Avatar flo5581

14/07 2015

1.0.1

1.0.1.0

Backend for laravel

  Sources   Download

The Requires

 

by Avatar flo5581

13/07 2015

1.0.0

1.0.0.0

Backend for laravel

  Sources   Download

The Requires

 

by Avatar flo5581