Sin descripción
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

KelompokDriverController.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace App\Http\Controllers\Api\V1;
  3. use App\Http\Controllers\Controller;
  4. use Illuminate\Support\Facades\DB;
  5. use App\Model\Raharja\KelompokDriver;
  6. use Illuminate\Support\Facades\Auth;
  7. class KelompokDriverController extends Controller
  8. {
  9. public function __construct()
  10. {
  11. DB::enableQueryLog();
  12. }
  13. public function getAll()
  14. {
  15. $query = KelompokDriver::get();
  16. if($query){
  17. $result = $query;
  18. $res_status = true;
  19. $msg = 'Mendapatkan Data';
  20. $status_msg = $msg;
  21. return $this->resSuccess(null, $res_status, $msg, $status_msg, $result);
  22. }else {
  23. $res_status = false;
  24. $msg = 'Data tidak ditemukan';
  25. $status_msg = $msg;
  26. return $this->resSuccess(null, $res_status, $msg, $status_msg, null);
  27. }
  28. }
  29. public function resSuccess($param = null, $status = null, $msg = null, $status_msg = null, $result = null)
  30. {
  31. $response['response'] = array(
  32. 'status' => $status,
  33. 'message' => $msg,
  34. 'status_msg' => $status_msg,
  35. );
  36. $response['param'] = !empty($param) ? $param : '';
  37. $response['results'] = $result;
  38. return response()->json($response, 200);
  39. }
  40. }