Skip to content

Commit 038cb91

Browse files
author
root
committed
uses
1 parent 8ef3c91 commit 038cb91

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

api/DomainController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
class DomainController extends Controller
88
{
9+
// This will be our default Response for the whole api routes.
910
public function index()
1011
{
1112
dd('You Shall Not Passed!');

routes/api.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44

55
/*
66
|--------------------------------------------------------------------------
7-
| Our Main Api Domain if We use api.domain.com
8-
| Avoid Showing the Default Site Content
7+
| To Use api.domain.com
8+
| Make Sure to Add it on .env
9+
| API_DOMAIN= and replace the API_PREFIX
910
|--------------------------------------------------------------------------
1011
|
1112
*/
1213

13-
// $api->version('v1', function ($api) {
14-
// $api->get('/', ['as' => 'api.index', 'uses' => 'Api\DomainController@index']);
15-
// });
14+
$api->version('v1', function ($api) {
1615

1716
/*
1817
|--------------------------------------------------------------------------
@@ -51,7 +50,7 @@
5150
|--------------------------------------------------------------------------
5251
|
5352
*/
54-
$api->version('v1', function ($api) {
53+
5554
$api->group(['prefix' => 'auth'], function($api) {
5655
// Working Tested , We Added check in exception in guest middleware for Unwated Behaviour
5756
$api->post('check', 'Api\V1\Auth\Controllers\LoginController@check');
@@ -79,4 +78,14 @@
7978
$api->version('v1', function ($api) {
8079
$api->get('/users', ['as' => 'api.index', 'uses' => 'Api\V1\Users\Controllers\UsersController@index']);
8180
$api->get('/user/{id}', ['as' => 'api.index', 'uses' => 'Api\V1\Users\Controllers\UsersController@show']);
81+
});
82+
83+
/*
84+
|--------------------------------------------------------------------------
85+
| Wildcard Default Response in Api Routes
86+
|--------------------------------------------------------------------------
87+
|
88+
*/
89+
$api->version('v1', function ($api) {
90+
$api->get('/{wildcard?}', ['as' => 'api.index', 'uses' => 'Api\DomainController@index'])->where('wildcard', '[\/\w\.-]*')->name('app');
8291
});

routes/web.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
// We Will Use Vue Router Instead of Laravel Routing System
3+
// Entry Point For Our Vue JS App
44
Route::get('/{vue?}', function () {
55
return view('app');
66
})->where('vue', '[\/\w\.-]*')->name('app');

0 commit comments

Comments
 (0)