Support the ongoing development of Laravel.io →
Blade Forms Validation
Last updated 2 years ago.
0

You have multiple routes leading to the same controller methods. Is there a reason for that?

You also have a Route::any before a Route::post for the same URI. That's an issue because I think for these two routes - 'dnslookup' and 'hostlookup' - it will never trigger the post route because it'll always be triggered by the any route.

0

Hey Thanks for the Reply, I am currenly accessing fist two routes and secondly on my local system, development machine. its working fine

Route::get('hostname', 'DNSController@index'); 
Route::post('hostname', 'DNSController@lookup'); 
Last updated 9 years ago.
0

If you dd() your results, what do you get?

public function lookup(HostnameRequest $request)
{
	$hostlookup = $request->input('hostlookup');
	dd($hostlookup);
	$hostname = gethostbyaddr($hostlookup);
	return view('hostname')->with('hostname', $hostname);
}
0

It shows nothing, I think its not checking

Route::post('hostname', 'DNSController@lookup');
0

Are you accessing the route through a form? If so, can you post that code?

0

Well, When I Access this Route, it just take me to the form page

Route::get('hostname', 'DNSController@index'); 

When I Lookup an IP Address and Hit Enter, it should take me to this Route,

Route::post('hostname', 'DNSController@lookup'); 

here is the form code,

<form name="user_form" id="dnslookup" action="{{ url() }}/hostname" method="POST">
<input type="hidden" name="_token" value="{{ csrf_token() }}"> 
<div class="row center-block">
<div class="col-lg-6 center-block">
<div class="input-group">
<input type="text" id="hostlookup" name="hostlookup" value="" class="form-control" placeholder="Search for Address" required>
<span class="input-group-btn">
<button class="btn btn-default" type="hostsubmit">Lookup</button>
</span>
</div>
</div>
</div>
</form> 
Last updated 9 years ago.
0

If you run this command, php artisan route:list, what do you get?

0

I can see these routes in the list,

 POST                           | hostname                   |         | App\Http\Controllers\DNSController@lookup            | guest      |
|        | GET|HEAD                       | hostname                   |         | App\Http\Controllers\DNSController@index             | guest      |
0

Are you logged in by any chance since it has the guest middleware applied to it?

0

I am using middleware just only, still no logged in function or module created and just for the sack of testing, I have just removed this but still no success on live website

0

Hm...everything looks okay, although I would change your button. It should be type="submit".

<button class="btn btn-default" type="submit">Lookup</button>

Also, make sure that in your request file, authorize is set to true.

Edit: Also, if you dd() inside the request file, does it trigger?

Last updated 9 years ago.
0

Ahh ! Well there was a silly mistake , I was missing lookup name in form.

0

Lol. Okay. :) That happens to all of us.

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.