2017 © Pedro Peláez
 

library easy_crud

Allow you to create a simple CRUD controller

image

efrontsa/easy_crud

Allow you to create a simple CRUD controller

  • Tuesday, January 17, 2017
  • by efrontsa
  • Repository
  • 1 Watchers
  • 2 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Easy CRUD

Allow you to create a simple CRUD controller, (*1)

Installation

composer require efrontsa/easy_crud

After install this package you have to set the service provider on your config/app.php file, (*2)

EFrontSA\EasyCRUD\ServiceProvider::class,

Then you just need to publish files ! Copy and paste it, (*3)

php artisan vendor:publish --provider="EFrontSA\EasyCRUD\ServiceProvider"

That's it!, (*4)

How to use

Create Controller

  • you have to use BasicCRUDTrait trait in your controller and define some variables in your constructor
  • Inject you model into your constructor like City
  • change $this->view to where your views are located. the trait look for (index, create, edit) views.

Ex. :, (*5)

class CityController extends Controller
{
    use \EFrontSA\EasyCRUD\Models\BasicCRUDTrait;

    public function __construct(City $model) // You can change the model type hint to update the model in this controller
    {
        $this->model = $model;
        $this->view = 'cities'; // where the views located. the trait look for (index, create, edit) views.

        app()->bind(CRUDRequest::class, CityRequest::class); // bind your request with CRUDRequest interface
    }
}

Create Form Request

Your form request should implement this interface \EFrontSA\EasyCRUD\Requests\CRUDRequest, (*6)

class CityRequest extends Request implements CRUDRequest{

}

Create Views

create your views (index, create, edit)., (*7)

  • edit view will receive $object variable as the result of model query.
  • index view will receive $objects variable as the result of model query.

The Versions

17/01 2017

dev-master

9999999-dev

Allow you to create a simple CRUD controller

  Sources   Download

MIT

16/11 2016

1.2

1.2.0.0

Allow you to create a simple CRUD controller

  Sources   Download

MIT

15/11 2016

1.1

1.1.0.0

Allow you to create a simple CRUD controller

  Sources   Download

MIT

15/11 2016

1.0

1.0.0.0

Allow you to create a simple CRUD controller

  Sources   Download

MIT