PHP code example of bantenprov / laravel-opd

1. Go to this page and download the library: Download bantenprov/laravel-opd 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/ */

    

bantenprov / laravel-opd example snippets


'providers' => [
    ...
    App\Providers\AppServiceProvider::class,
    App\Providers\AuthServiceProvider::class,
    App\Providers\EventServiceProvider::class,
    App\Providers\RouteServiceProvider::class,
    ...
    
    Bantenprov\LaravelOpd\LaravelOpdServiceProvider::class,
    Emadadly\LaravelUuid\LaravelUuidServiceProvider::class,

'aliases' => [
    ...
    'Storage' => Illuminate\Support\Facades\Storage::class,
    'URL' => Illuminate\Support\Facades\URL::class,
    'Validator' => Illuminate\Support\Facades\Validator::class,
    'View' => Illuminate\Support\Facades\View::class,
    ...
    'Opd' => Bantenprov\LaravelOpd\Facades\LaravelOpd::class,

'default_uuid_column' => 'id',

public static function columns(Blueprint $table)
{
    $table->unsignedInteger(self::LFT)->default(0);
    $table->unsignedInteger(self::RGT)->default(0);
    $table->string(self::PARENT_ID)->nullable();

    $table->index(static::getDefaultColumns());
}

//web.php
Route::get('/opd/tree', function () {
    return Opd::tree();
})->name('opd.tree');

Route::get('/opd', function () {
    $opds =  Opd::index();
    return view('laravel-opd::unit_kerja.index',compact('opds'));
})->name('opd.index');

Route::get('/opd/create-root',function(){
    return view('laravel-opd::unit_kerja.create-root');
})->name('opd.create_root');

Route::get('/opd/create-child',function(){
    $unit_kerjas =  Opd::index();
  
    return view('laravel-opd::unit_kerja.create-child',compact('unit_kerjas'));
})->name('opd.create_child');

// web.php
Route::get('/opd', function () {
    return Opd::tree();
});

// web.php
Route::get('/opd/create-root','\Bantenprov\LaravelOpd\Http\Controllers\LaravelOpdController@createRoot')->name('createRoot');

//web.php
Route::get('/opd', function () {
    return view('laravel-opd::unit_kerja.create-root');
});

1. http://127.0.0.1:8000/laravel-opd/
2. http://127.0.0.1:8000/laravel-opd/create-root
3. http://127.0.0.1:8000/laravel-opd/create-child
bash
$ php artisan vendor:publish --tag=migrations
$ php artisan vendor:publish --tag=views
$ php artisan vendor:publish --provider="Emadadly\LaravelUuid\LaravelUuidServiceProvider"
bash
$ php artisan migrate