kilroyweb / Cruddy by kilroyweb

Laravel CRUD Helper
20
1
1
Package Data
Maintainer Username: kilroyweb
Maintainer Contact: jeff@kilroyweb.com (Kilroy Web Development)
Package Create Date: 2016-12-12
Package Last Update: 2016-12-12
Language: PHP
License: MIT
Last Refreshed: 2024-05-03 03:01:44
Package Statistics
Total Downloads: 20
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 1
Total Watchers: 1
Total Forks: 1
Total Open Issues: 0

#Cruddy

A simple Laravel CRUD helper

Install

composer require kilroyweb/cruddy

In config/app.php 'providers':

KilroyWeb\Cruddy\CruddyServiceProvider::class,

In config/app.php 'facades':

'Cruddy'=> KilroyWeb\Cruddy\Facades\Cruddy::class,

Usage

Controllers:

Create new controllers extending the CruddyController via:


<?php

namespace App\Http\Controllers\Books;

use KilroyWeb\Cruddy\Controllers\CruddyController;

class BookController extends CruddyController{

    protected $model = \App\Book::class;

}

This will create a controller with the following: methods

  • index: returns a variable with all models with a plural name of the model (ie: $books)
  • create
  • store: stores the model and redirects to /index with a success message
  • edit: returns a variable with the given model id with a singular name of the model (ie: $book)
  • update: updates the model and redirects to /index with a success message
  • destroy: deletes the model and redirects to /index with a success message