PHP code example of triun / laravel-model-base

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

    

triun / laravel-model-base example snippets


Triun\ModelBase\ModelBaseServiceProvider::class,

public function register()
{
    if ($this->app->environment() !== 'production') {
        $this->app->register(\Triun\ModelBase\ModelBaseServiceProvider::class);
    }
    // ...
}


# bootstrap/app.php

$app = new Laravel\Lumen\Application(
    realpath(__DIR__.'/../')
);

$app->withFacades(true, [
    Illuminate\Support\Facades\App::class => 'App',
    Illuminate\Support\Facades\File::class => 'File',
]);
$app->withEloquent();
$app->register(App\Providers\AppServiceProvider::class);


namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    public function register()
    {
        $this->app->instance('path.config', app()->basePath() . DIRECTORY_SEPARATOR . 'config');
        
        if ($this->app->environment() !== 'production') {
            $this->app->configure('model-base');
            $this->app->register(\Triun\ModelBase\ModelBaseServiceProvider::class);
        }
    }
}
bash
php artisan vendor:publish --provider="Triun\ModelBase\ModelBaseServiceProvider" --tag=config
bash
cp vendor/triun/laravel-model-base/config/model-base.php config/