PHP code example of brainlabsweb / repository-generator

1. Go to this page and download the library: Download brainlabsweb/repository-generator 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/ */

    

brainlabsweb / repository-generator example snippets


namespace App\Http\Controllers;

 

class BookController extends Controller {
    
    /**
    * @var BookContract
    */
    private $bookContract;

    /**
    * BookController constructor
    * BookContract $bookContract
    */
    public function __construct(BookContract $bookContract) 
    {
        $this->bookContract = $bookContract;
    }

}





namespace App\Repository\Book;

use App\Book;

class BookRepository implements BookContract
{

    /**
     * @var Book
     */
    private $book;

    /**
     * BookRepository constructor.
     * @param  Book  $book
     */
    public function __construct(Book $book)
    {
        $this->book = $book;
    }

    // your code goes here
}





namespace App\Repository\Book;

interface BookContract
{
    // your code goes here 
}





namespace App;

use Illuminate\Database\Eloquent\Model;

class Book extends Model
{
    // your code goes here
}