jan-dolata/crude-crud
Crude CRUD for Laravel
2,018
1
| Install | |
|---|---|
composer require jan-dolata/crude-crud |
|
| Latest Version: | v1.1.27 |
| PHP: | ~5.5|~7.0 |
| License: | MIT |
| Last Updated: | Mar 28, 2017 |
| Links: | GitHub · Packagist |
Maintainer: jan-dolata
crude-crud
Table of content
Install
Via Composer
$ composer require jan-dolata/crude-crud
Add ServiceProvider to config/app.
JanDolata\CrudeCRUD\CrudeCRUDServiceProvider::class
Publish and migrate
$ php artisan vendor:publish --provider="JanDolata\CrudeCRUD\CrudeCRUDServiceProvider"
$ php artisan migrate
Check config file config/crude.php.
Usage
create dir
app/Engine/Crude
in app/Engine/Crude directory create class for list
<?php
namespace App\Engine\Crude;
use Crude;
use CrudeListInterface;
use CrudeFromModelTrait;
class ListName extends Crude implements
CrudeListInterface
{
use CrudeFromModelTrait;
public function __construct()
{
$this->setModel(new \App\Engine\Models\ModelName);
$this->prepareCrudeSetup();
}
}
in controller action
return view('viewName', [
'crudeSetup' => [(new \App\Engine\Crude\ListName)->getCrudeSetupData()]
]);
in view
@include('CrudeCRUD::start')
it works.
=============
Example
Part of create books table migration
public function up()
{
Schema::create('books', function (Blueprint $table) {
$table->increments('id');
$table->string('tile');
$table->integer('order');
$table->timestamps();
});
}
namespace App\Models;
class Book extends \Illuminate\Database\Eloquent\Model
{
protected $fillable = ['title'];
}
use Auth;
class BooksList extends \Crude implements \CRUDInterface, \CrudeOrderInterface
{
use \CrudeFromModelTrait;
public function __construct()
{
$this->setModel(new \App\Models\Book);
$this->prepareCrudeSetup();
$this->crudeSetup
->setTitle('List of books')
->setTrans(['id' => 'Id', 'title' => 'Title', 'order' => '#'])
->setColumnFormat('title', 'longtext');
$this->storeInFirstPlace();
if (! Auth:user()->cannotOrderListOfBooks())
$this->crudeSetup->useOrderedList('title');
}
}

Change log
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Security
If you discover any security related issues, please email jan.dolata.gd@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Related Packages
erirk/paypalpayment
laravel-paypalpayment is simple package help you process direct credit card paym...
0
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
628,058,007
9,707