diff --git a/app/Http/Controllers/CompanyController.php b/app/Http/Controllers/CompanyController.php index 397ff69..158afda 100644 --- a/app/Http/Controllers/CompanyController.php +++ b/app/Http/Controllers/CompanyController.php @@ -28,9 +28,13 @@ class CompanyController extends Controller default: $emps = $emps->orderBy('id')->orderby('updated_at'); break; } } + if (is_null($request->get('sort'))){ - $emps = $emps->paginate(4); + $emps = $emps->orderByDesc('created_at')->orderBy('id'); + + } + $emps = $emps->paginate(4); if ($request->ajax()) { if ($request->get('block') == '1') diff --git a/resources/views/companies.blade.php b/resources/views/companies.blade.php index 5db8895..4a62d0e 100644 --- a/resources/views/companies.blade.php +++ b/resources/views/companies.blade.php @@ -107,7 +107,7 @@ - +