I have admin
subfolder in the public
folder, but I want to define the specific response on mywebsite.loc/admin
. Currently, if to input mywebsite.loc/admin
, it will be next response:
However I has the routes definition for admin
:
Route::group(['prefix' => 'admin', 'middleware' => 'auth'], function(){
Route::get('/', [
'as' => 'AdminTop',
'uses' => //Admin\AdminController@renderTopPage'
function(){
dd('ok');
}
]);
});
How I can make it work?
Route::get('login', 'AuthController@getLogin'); Route::post('login', 'AuthController@postLogin'); So instead of having to write both you only have to write one since their both using the 'same' method but also the URL remains as site.com/login instead of a redirect to site.com/auth/login ?
All Laravel routes are defined in your route files, which are located in the routes directory. These files are automatically loaded by your application's App\Providers\RouteServiceProvider . The routes/web.php file defines routes that are for your web interface.
Named routes is an important feature in the Laravel framework. It allows you to refer to the routes when generating URLs or redirects to the specific routes. In short, we can say that the naming route is the way of providing a nickname to the route.
If you create any folder in public and you want to use this folder as a route then you need to add your index.php which is useful for understanding this folder as a root.
For example, you create one folder in public/admin now you copy your public/index.php file into your admin folder and change two line in this index.php file
require __DIR__.'/../bootstrap/autoload.php';
TO
require __DIR__.'/../../bootstrap/autoload.php';
And
$app = require_once __DIR__.'/../bootstrap/app.php';
TO
$app = require_once __DIR__.'/../../bootstrap/app.php';
I think it helps in your requirements.
Sorry for my bad english
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With