I have a Laravel 5.2 Practice application which is running with Laravel Serve running like this
Working Perfectly , The form blade is following
@extends('layouts.app')
@section('form')
<div class="col-md-4">
@if(count($errors)>0)
<div class="alert alert-danger">
@foreach($errors->all() as $error)
{{ $error }}
@endforeach
</div>
@endif
<form action="/" method="post">
<div class="form-group">
<label>I want to</label>
<select class="form-control" name="action">
<option value="greet">Greet</option>
<option value="hug">Hug</option>
<option value="kiss">Kiss</option>
</select>
</div>
<div class="form-group">
<label>this person</label>
<input type="text" class="form-control" name="name" >
<input type="hidden" name="_token" value="{{ csrf_token() }}">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success "> Do it! </button>
</div>
</form>
</div>
@endsection
With Following POST route entry in routes
Route::post('/', 'adminController@post');
Problem
When I run the same application using Wamp server instead of Laravel Server
I press submit button, it takes me to localhost
Is it possible to write a route entry which can perform in both situations, with and without Laravel Server running. ?
These are my routes
Route::get('/', [
'uses' => 'adminController@index',
'as' => 'home'
]);
Route::get('/hug/{name?}', [
'uses' => 'adminController@hug',
'as' => 'hug'
]);
Route::get('/kiss/{name?}', [
'uses' => 'adminController@kiss',
'as' => 'kiss'
]);
Route::get('/form', [
'uses' => 'adminController@form',
'as' => 'form'
]);
Route::post('/', 'adminController@post')->name('index');
Route::auth();
Route::get('/home', 'adminController@index');
Route::get('/logout',function(){
Auth::logout();
return Redirect::to('/home');
});