Skip to content

Instantly share code, notes, and snippets.

@sorora
Created December 19, 2013 18:08
Show Gist options
  • Save sorora/8043610 to your computer and use it in GitHub Desktop.
Save sorora/8043610 to your computer and use it in GitHub Desktop.
<?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());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment