Skip to content

Instantly share code, notes, and snippets.

@sorora
Created December 19, 2013 18:08

Revisions

  1. sorora created this gist Dec 19, 2013.
    23 changes: 23 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    <?php namespace MyApp\Models\Repositories;

    abstract class EloquentBaseRepository {

    protected $model;

    public function __construct()
    {
    $model = explode('\\', get_class($this));
    $this->model = $model[count($model)-2];
    }

    public function example()
    {
    return call_user_func_array(array($this->model, 'example'), func_get_args());
    }

    public function example2()
    {
    return call_user_func_array(array($this->model, 'example2'), func_get_args());
    }

    }