2017 © Pedro Peláez
 

library genericcrud

A GenericCRUD controller trait and corresponding views

image

coopers98/genericcrud

A GenericCRUD controller trait and corresponding views

  • Tuesday, June 5, 2018
  • by coopers98
  • Repository
  • 1 Watchers
  • 0 Stars
  • 407 Installations
  • HTML
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 17 Versions
  • 7 % Grown

The README.md

NOTICE!!!

This is quite old at this point, and is now deprecated and no longer in use. I am leaving this up and publically viewable for posterity sake., (*1)

If you are using Laravel, I recommend using Nova [https://nova.laravel.com/] or Filament [https://filamentphp.com/] for general CMS use cases., (*2)

GenericCRUD

A Laravel GenericCRUD Controller trait and corresponding views to give a lightweight way to scaffold database tables in Laravel., (*3)

This package evolved from what originally was a vanilla GenericUpdate package that was eventually written for Kohana and now finally for Laravel. So while there are likely much better ways of completing these tasks, this has been around a while., (*4)

Installation

composer require coopers98/genericcrud

Service Provider

In your app config, add the GenericCRUD to the providers array., (*5)

'providers' => [
    coopers98\GenericCRUD\GenericCRUDServiceProvider::class,
    ];

Usage

Be warned that this isn't really a turn key package right now. You'll likely need to dive into the source a little to understand how it is all going. Fear not, it is pretty straight forward and shouldn't be too hard to follow., (*6)

This is a trait so use it on a Controller that you want to have the Generic CRUD functionality on., (*7)

In your routes.php file, add a resource, (*8)

Route::resource( 'post', 'PostController' );

Create your Controller and use the trait, (*9)


use coopers98\GenericCRUD\GenericCRUD; class PostController extends Controller { use GenericCRUD; public function __construct() { parent::__construct(); // // The name of the database table // $this->table_name = 'posts'; // // Name of the resource link from your routes file // $this->resourceLink = 'post'; // // Optional overrides/settings // // Ignored columns will not be shown in the views // $this->ignored_columns = [ 'created_at', 'updated_at', 'deleted_at' ]; // // Readonly columns will not be allowed to be edited (such as id fields, set by default ) // $this->readonly_columns = [ 'id' ]; // // Override the master template // $this->masterTemplate = 'some_layout'; // // You can override any of the blade views to customize the display of the dataset // $this->showView = 'post.show'; // $this->indexView = 'post.index'; // $this->confirmDeleteView = 'post.confirm_delete'; // $this->editView = 'post.edit'; // $this->createView = 'post.create'; // // Call the populate columns function to load column data // $this->populateColumns(); } }

Once you have done that, by default, you will have basic CRUD functionality, (*10)

Index Show Create Store Edit Update Destroy, (*11)

Additionally, you can override the resource actions to either gather additional data, provide additional data or otherwise change functionality., (*12)

There are also authorization checks called for each action., (*13)

    public function authorizeDelete() {
        //  Override this function and redirect or otherwise to prevent the action from completing
        //  The return value is not checked, so you should just return a redirect response here
    }

This package also includes a generic table exporter that uses the League/CSV package to export the given index view as a csv file., (*14)

License

The GenericCRUD is open-sourced software licensed under the MIT license, (*15)

The Versions

05/06 2018

dev-dev

dev-dev

A GenericCRUD controller trait and corresponding views

  Sources   Download

MIT

The Requires

 

by Cooper Sellers

laravel crud scaffold

05/06 2018

dev-master

9999999-dev

A GenericCRUD controller trait and corresponding views

  Sources   Download

MIT

The Requires

 

by Cooper Sellers

laravel crud scaffold

05/06 2018

5.6

5.6.0.0

A GenericCRUD controller trait and corresponding views

  Sources   Download

MIT

The Requires

 

by Cooper Sellers

laravel crud scaffold

26/04 2018

0.1.2

0.1.2.0

A GenericCRUD controller trait and corresponding views

  Sources   Download

MIT

The Requires

 

by Cooper Sellers

laravel crud scaffold

26/04 2018

0.1.2.x-dev

0.1.2.9999999-dev

A GenericCRUD controller trait and corresponding views

  Sources   Download

MIT

The Requires

 

by Cooper Sellers

laravel crud scaffold

12/12 2017

5.5.1

5.5.1.0

A GenericCRUD controller trait and corresponding views

  Sources   Download

MIT

The Requires

 

by Cooper Sellers

laravel crud scaffold

12/12 2017

dev-develop

dev-develop

A GenericCRUD controller trait and corresponding views

  Sources   Download

MIT

The Requires

 

by Cooper Sellers

laravel crud scaffold

12/12 2017

5.5.0

5.5.0.0

A GenericCRUD controller trait and corresponding views

  Sources   Download

MIT

The Requires

 

by Cooper Sellers

laravel crud scaffold

12/12 2017

5.4.0

5.4.0.0

A GenericCRUD controller trait and corresponding views

  Sources   Download

MIT

The Requires

 

by Cooper Sellers

laravel crud scaffold

17/11 2016

0.1.3

0.1.3.0

A GenericCRUD controller trait and corresponding views

  Sources   Download

MIT

The Requires

 

by Cooper Sellers

laravel crud scaffold

29/12 2015

0.1.1

0.1.1.0

A GenericCRUD controller trait and corresponding views

  Sources   Download

MIT

The Requires

 

by Cooper Sellers

laravel crud scaffold

29/12 2015

0.1.0

0.1.0.0

A GenericCRUD controller trait and corresponding views

  Sources   Download

MIT

The Requires

 

by Cooper Sellers

laravel crud scaffold

29/12 2015

0.0.5

0.0.5.0

A GenericCRUD controller trait and corresponding views

  Sources   Download

MIT

The Requires

 

by Cooper Sellers

laravel crud scaffold

22/12 2015

0.0.4

0.0.4.0

A GenericCRUD controller trait and corresponding views

  Sources   Download

MIT

The Requires

 

by Cooper Sellers

laravel crud scaffold

09/10 2015

0.0.3

0.0.3.0

A GenericCRUD controller trait and corresponding views

  Sources   Download

MIT

The Requires

 

by Cooper Sellers

laravel crud scaffold

09/10 2015

0.0.2

0.0.2.0

A GenericCRUD controller trait and corresponding views

  Sources   Download

MIT

The Requires

 

by Cooper Sellers

laravel crud scaffold

09/10 2015

0.0.1

0.0.1.0

A GenericCRUD controller trait and corresponding views

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Cooper Sellers

laravel crud scaffold