Guest User

Untitled

a guest
May 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Repositories;
  4.  
  5. use DB;
  6.  
  7. abstract class AbstractRepository
  8. {
  9. private $model;
  10.  
  11. public function __construct($model = null)
  12. {
  13. $this->model = $model;
  14. }
  15.  
  16. public function all($columns = array('*'), $table = null)
  17. {
  18. if($table == null)
  19. {
  20. return $this->model->select($columns)->orderBy('created_at', 'asc')->get();
  21. }
  22. else
  23. {
  24. return DB::table($table)->orderBy('created_at', 'asc')->get($columns);
  25. }
  26. }
  27. }
Add Comment
Please, Sign In to add comment