Last active
July 24, 2017 08:34
-
-
Save the94air/dd95f503c613949573d4882da8e66b62 to your computer and use it in GitHub Desktop.
Revisions
-
the94air revised this gist
Jul 24, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ <?php class ArticlesController extends Controller { @@ -12,7 +12,7 @@ public function show() return view('articles.show')->withArticles(); } else { // return Datatable ajax view. // Make your own api to send the table data to the view. return view('articles.ajax-show'); } } -
the94air created this gist
Jul 24, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ ?> class ArticlesController extends Controller { public function show() { $count = Article::count(); if($count < [?]) { // return the normal http view. // the datatable will handle the dirty work. $articles = Article::pluck('id', 'title', 'updated_at', 'active'); return view('articles.show')->withArticles(); } else { // return Datatable ajax view. // use articles api to get the table data. return view('articles.ajax-show'); } } }