Skip to content

Instantly share code, notes, and snippets.

@lloy0076
Created February 20, 2017 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lloy0076/82d84d9dd3af2736195b5df8aebca4c6 to your computer and use it in GitHub Desktop.
Save lloy0076/82d84d9dd3af2736195b5df8aebca4c6 to your computer and use it in GitHub Desktop.
```
<?php
namespace App\Http\Controllers\Admin;
use Backpack\CRUD\app\Http\Controllers\CrudController;
// VALIDATION: change the requests to match your own file names if you need form validation
use App\Http\Requests\MytestRequest as StoreRequest;
use App\Http\Requests\MytestRequest as UpdateRequest;
class MytestCrudController extends CrudController
{
public function setUp()
{
/*
|--------------------------------------------------------------------------
| BASIC CRUD INFORMATION
|--------------------------------------------------------------------------
*/
if ((int)config('backpack.crud.ajax_table_count', 256) !== -1 &&
\App\Models\Mytest::count() >= config('backpack.crud.ajax_table_count', 256))
{
$this->crud->enableAjaxTable();
}
$this->crud->setModel("App\Models\Mytest");
$this->crud->setRoute("/admin/mytest");
$this->crud->setEntityNameStrings('mytest', 'mytests');
/*
|--------------------------------------------------------------------------
| BASIC CRUD INFORMATION
|--------------------------------------------------------------------------
*/
$this->crud->setFromDb();
// Snipped out other code.
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment