Wednesday, March 1, 2017

Laravel 5.2: Route without running Laravel Serve not working.

I have a Laravel 5.2 Practice application which is running with Laravel Serve running like this Laravel 5.2 Practice

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)
        
    @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="">
    </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

Laravel 5.2 Practice Application

I press submit button, it takes me to localhost

Wamp Server Localhost

Is it possible to write a route entry which can perform in both situations, with and without Laravel Server running. ?




via Malik Mudassar

Advertisement