PHP code example of chihchenghuang / laravel-mrs-generators

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

    

chihchenghuang / laravel-mrs-generators example snippets

 php


//app.php

'providers' => [
        
        /*
         * Laravel MRS Generators Service Provider
         */
        \ChihCheng\MRSGenerators\GeneratorsServiceProvider::class,

    ],

 php


//app/Providers/AppServiceProvider.php

    public function register()
    {
        if ($this->app->environment() == 'local')
        {
	        /*
	         * Laravel MRS Generators Service Provider
	         */
            $this->app->register( \ChihCheng\MRSGenerators\GeneratorsServiceProvider::class );

        }
    }


    $ php artisan make:repository Repositories/TestRepository

    $ php artisan make:repository Services/TestService

    $ php artisan make:mrs-model Test
 php


namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Test extends Model
{
    //
}

 php


namespace App\Repositories;

use App\Models\Test;

class TestRepository
{
    protected $test;

    public function __construct( Test $test )
    {
        $this->test = $test;
    }

}

 php


namespace App\Services;

use App\Repositories\TestRepository;

class TestService
{
    protected $testRepository;

    public function __construct( TestRepository $testRepository )
    {
        $this->testRepository = $testRepository;
    }

}