Advertisement
freddy0512

FreddyController.php

Jan 13th, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Http\Controllers;
  4.  
  5. use Illuminate\Http\Request;
  6.  
  7. use App\Http\Requests;
  8.  
  9. use App\Freddy;
  10. use DB;
  11.  
  12.  
  13. class FreddyController extends Controller
  14. {
  15. //
  16. public function getFreddy(Request $request)
  17. {
  18.  
  19.  
  20. //show data from database
  21. // $users = DB::table('dummy')->paginate(2);
  22. // return view('freddy/main', ['users' => $users]);
  23.  
  24.  
  25. //passong variable to view pakai with
  26. // $data = array(
  27. // 'author'=>'foo'
  28. // );
  29. // return view('freddy/passing')->with($data);
  30.  
  31.  
  32. $articles = DB::table('dummy')->paginate(5);
  33.  
  34. if ($request->ajax()) {
  35. return view('freddy/main', ['articles' => $articles])->render();
  36. }
  37.  
  38. return view('freddy/main', compact('articles'));
  39.  
  40.  
  41.  
  42.  
  43. }
  44.  
  45. /*
  46.  
  47. $contents = ($data['products']['sales']['contents']);
  48.  
  49. if ($contents != '0')
  50. {
  51. dd('ada');
  52. }
  53. else
  54. {
  55. dd('gak ada');
  56. }
  57.  
  58.  
  59. if ($contents == "")
  60. {
  61. $status = "error";
  62. $message = "failed";
  63. }
  64. else
  65. {
  66. $status ="ok";
  67. $message = "succes";
  68. }
  69.  
  70. */
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement