In laravel routes/web.php all website route are configured
There are multiple type of we will start with basic
Route::get('/', function () {
return 'Hello Edkool World';
});
replace route for / main root path with above code then visit site you will see message. This is simple return string.
Here get method is used, Similarly other methods can be used
- Get
- Post
- Put
- Patch
- Delete
for example in below example method will be post and test is the url
Route::post('/test', function () {
return 'Hello Edkool World';
});
if you directly go to /test it will give error thet get method not supported. Post is mostly used while submitting data using form with post method.