api.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. use Illuminate\Http\Request;
  3. /*
  4. |--------------------------------------------------------------------------
  5. | API Routes
  6. |--------------------------------------------------------------------------
  7. |
  8. | Here is where you can register API routes for your application. These
  9. | routes are loaded by the RouteServiceProvider within a group which
  10. | is assigned the "api" middleware group. Enjoy building your API!
  11. |
  12. */
  13. //Route::middleware('auth:api')->get('/user', function (Request $request) {
  14. // return $request->user();
  15. //});
  16. $api = app('Dingo\Api\Routing\Router');
  17. $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($api) {
  18. // test
  19. $api->get('test', [
  20. 'as' => 'test',
  21. 'uses' => 'AuthController@test',
  22. ]);
  23. // Auth
  24. // signin
  25. $api->post('auth/login', [
  26. 'as' => 'auth.login',
  27. 'uses' => 'AuthController@login',
  28. ]);
  29. $api->post('auth/logout', [
  30. 'as' => 'auth.logout',
  31. 'uses' => 'AuthController@logout',
  32. ]);
  33. $api->post('auth/code', [
  34. 'as' => 'auth.code',
  35. 'uses' => 'AuthController@getCode',
  36. ]);
  37. // signup
  38. $api->post('auth/register', [
  39. 'as' => 'auth.register',
  40. 'uses' => 'AuthController@register',
  41. ]);
  42. $api->post('auth/password', [
  43. 'as' => 'auth.reset',
  44. 'uses' => 'AuthController@setPassword',
  45. ]);
  46. $api->post('auth/check_password', [
  47. 'as' => 'auth.check_password',
  48. 'uses' => 'AuthController@check_password',
  49. ]);
  50. $api->post('auth/reset', [
  51. 'as' => 'auth.reset',
  52. 'uses' => 'AuthController@reset',
  53. ]);
  54. $api->get('auth/is_login', [
  55. 'as' => 'auth.is_login',
  56. 'uses' => 'AuthController@isLogin',
  57. ]);
  58. $api->get('home/index', [
  59. 'as' => 'home.index',
  60. 'uses' => 'HomeController@index',
  61. ]);
  62. });