Package Data | |
---|---|
Maintainer Username: | jan-dolata |
Maintainer Contact: | jan.dolata.gd@gmail.com (Jan Dolata) |
Package Create Date: | 2016-05-11 |
Package Last Update: | 2017-03-28 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-23 03:16:54 |
Package Statistics | |
---|---|
Total Downloads: | 2,014 |
Monthly Downloads: | 4 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 4 |
Total Forks: | 1 |
Total Open Issues: | 0 |
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
.
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.
=============
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');
}
}
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email jan.dolata.gd@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.