PHP code example of nikidze / laravel-repository-generator

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

    

nikidze / laravel-repository-generator example snippets


 namespace App\Http\Controllers;

use App\Repositories\PostRepository;

class PostController extends Controller {

    private $post;
    
    public function __construct(PostRepository $postRepository)
    {
        $this->post = $postRepository;
    }

    public function index() {
        return response()->json($this->post->all());
    }
}

    public function all();

    public function trashOnly();

    public function find($id);

    public function findTrash($id);

    public function findBy($column, $value);

    public function recent($limit);

    public function store($data);

    public function update($data, $id);

    public function trash($id);

    public function restore($id);

    public function destroy($id);

$post = $this->post->store($request->all());

$post = $this->post->update($request->all(), $post_id);

$post = $this->post->destroy($id);

$post = $this->post->find($id);

$post = $this->post->find($id);
bash
 php artisan make:repositories