kilroyweb / Cruddy by kilroyweb

Laravel CRUD Helper
22
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-11-22 03:04:03
Package Statistics
Total Downloads: 22
Monthly Downloads: 2
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