Guest User

Untitled

a guest
Jan 4th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <?php
  2. namespace AppHttpControllers;
  3.  
  4. use IlluminateHttpRequest;
  5. use AppRepositoriesUserRepository as User;
  6. use AppTraitsResponseTrait;
  7.  
  8. class HomeController extends Controller
  9. {
  10. use ResponseTrait;
  11.  
  12. private $user;
  13.  
  14. /**
  15. * Create a new controller instance.
  16. *
  17. * @return void
  18. */
  19. public function __construct(User $user)
  20. {
  21. $this->user = $user;
  22. $this->middleware('auth');
  23. }
  24.  
  25. /**
  26. * Show the application dashboard.
  27. *
  28. * @return IlluminateHttpResponse
  29. */
  30. public function index()
  31. {
  32. //dd($this->user->all()->toArray());
  33. //You can ignore the self:: part, as it doesn't reach this far.
  34. self::setData($this->user->all()->toArray());
  35. return "test";
  36. return view('home');
  37. }
  38. }
  39.  
  40. namespace AppTraits;
  41.  
  42. trait ResponseTrait {
  43. public function setData($array) {
  44.  
  45. }
  46. }
  47.  
  48. "psr-4": {
  49. "App\": "app/"
  50. }
Add Comment
Please, Sign In to add comment