1. Go to this page and download the library: Download nohara/laravel-genpack 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/ */
nohara / laravel-genpack example snippets
namespace App\Http\Controllers;
use Nohara\Genpack\Http\Controllers\BaseCrudController;
use Nohara\Genpack\Http\Controllers\Operations\ListOperation;
use Nohara\Genpack\Http\Controllers\Operations\CreateOperation;
use Nohara\Genpack\Http\Controllers\Operations\UpdateOperation;
use Nohara\Genpack\Http\Controllers\Operations\DeleteOperation;
use App\Models\Mahasiswa;
class MahasiswaCrudController extends BaseCrudController
{
// Gunakan Trait Operations secara modular sesuai kebutuhan
use ListOperation, CreateOperation, UpdateOperation, DeleteOperation;
protected function setup()
{
// 1. Konfigurasi Entitas & Model
$this->crud->setModel(Mahasiswa::class);
$this->crud->setEntityNameStrings('Mahasiswa', 'Mahasiswa');
$this->crud->setRoutePrefix('mahasiswa');
$this->crud->setThemeStyle('porto'); // Opsi: 'classic' atau 'porto'
// 2. Definisikan Kolom Tabel (DataTables)
$this->crud->addColumn([
'name' => 'nim',
'label' => 'NIM',
'type' => 'text',
]);
$this->crud->addColumn([
'name' => 'nama',
'label' => 'Nama Lengkap',
'type' => 'text',
]);
// 3. Definisikan Field Input Form (Modal Form)
$this->crud->addField([
'name' => 'nim',
'label' => 'NIM',
'type' => 'text',
'placeholder' => 'Masukkan NIM...',
'