1. Go to this page and download the library: Download jan-dolata/crude-crud library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jan-dolata / crude-crud example snippets
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();
}
}
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');
}
}