Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Repositories;
- use DB;
- abstract class AbstractRepository
- {
- private $model;
- public function __construct($model = null)
- {
- $this->model = $model;
- }
- public function all($columns = array('*'), $table = null)
- {
- if($table == null)
- {
- return $this->model->select($columns)->orderBy('created_at', 'asc')->get();
- }
- else
- {
- return DB::table($table)->orderBy('created_at', 'asc')->get($columns);
- }
- }
- }
Add Comment
Please, Sign In to add comment