Why is my page not being found?

Bruce Gust
Bruce Gust used Ask the Experts™
on
Here's the URL:

http://nomas.site/admin/show/page?id=3

Here's my routing:
Route::prefix('admin')->group(function() {
    Route::get('/dashboard', 'AdminController@dashboard')->name('adminDashboard');
    Route::get('/users', 'AdminController@dashboard')->name('adminUsers');
	Route::get('/list/page', 'PageController@index')->name('adminListPages');
	Route::get('/insert/page', 'PageController@insertPage')->name('adminInsertPage');
	[b]Route::get('/show/page{id}', 'PageController@show')->name('adminShowPage');[/b]
	Route::post('/edit/page', 'PageController@edit')->name('adminEditPage');
	Route::post('/create/page', 'PageController@store')->name('adminStorePage');
	
});

Open in new window

Here's my Controller:
    public function show($id)
    {
        //
		
		$page=Page::findOrFail($id);
		return view('/admin/showPage', compact('page'));
		
    }

Open in new window

...and here's my View:

@extends('../layouts.satellite')
@section('content')
<!-- Section: intro -->
<section id="intro" class="intro">
	<div class="satellite-content">
		<div class="container">
			<div class="row">
				<div class="col-xs-12 satellite_row">
					<h5>NOMAS<sup>&reg;</sup> International Admin New Page Form</h5>
					<div class="row">
						<div class="col-xs-12">
						Hello, {{ Auth::user()->name }}!
						<br><br>
						To make any changes to the page that you've just selected, simply edit the content of the fields below and click on "submit."
						<br><br>
						If you have any questions or need any assistance, contact Bruce Gust at <a href="mailto:bruce@brucegust.com">bruce@brucegust.com</a>.
						<br><br>
						Thanks!
						</div>
					</div>
					<div class="row">
						<div class="col-xs-12"><hr></div>
					</div>
					@if($errors->any())
						<div class="alert alert-danger">
							<ul>
								@foreach($errors->all() as $error)
									<li>{{ $error }} </li>
								@endforeach
							</ul>
						</div>
					@endif
					<form method="Post" action="{{ route('adminStorePage') }}">
						<div class="form-group">
							<input type="hidden" value="{{csrf_token()}}" name="_token">
							<div class="row">
								<div class="col-xs-12">
									<label for="title">Page Title</label>
									<input type="text" class="form-control" name="title" id="title" value="{{ $page->title }}">
								</div>
							</div>
							<div class="row">
								<div class="col-xs-12">
									<label for="title">Body</label>
									<textarea class="form-control" id="body" name="body">{{ $page->body }}</textarea>
								</div>
							</div>
							<div class="row">
								<div class="col-xs-12" style="text-align:center;"><input type="hidden" name="user_id" value="{{Auth::user()->id}}"><br>
									<input type="image" name="submit" src="{{ asset('assets/img/nomas_submit.jpg') }}" style="width:150px;">
								</div>
							</div></form>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</section>
@endsection

Open in new window


I keep getting a 404 error that the page isn't found. No idea why.

Thoughts?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Bruce GustPHP Developer

Author

Commented:
I'm running Laravel 6.
Ryan ChongSoftware Team Lead

Commented:
The domain seems not working.

C:\Users\xxxxx>ping www.nomas.site
Ping request could not find host www.nomas.site. Please check the name and try again.

Open in new window


have you configured the domain correctly?
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
I tried to lookup the IP and whois for 'nomas.site' and there was no response.  That means the internet thinks it does not exist.
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

Most Valuable Expert 2018
Distinguished Expert 2018
Commented:
Hey Bruce,

Despite the server not being found, you might want to look at your routes and how you request the page. With Laravel, normally you'd request it without the query string part, like so:

http://nomas.site/admin/show/page/3

And your route would look like this:

Route::get('/show/page/{id}', 'PageController@show')->name('adminShowPage');
David FavorFractional CTO
Distinguished Expert 2018

Commented:
First problem is with DNS, so you must fix this first to determine if you have any code problem.

# Correct DNS output...
imac> dig +short davidfavor.com a
144.217.145.114

# DNS for your site shows no DNS records setup for your site
imac> dig +short nomas.site a

imac> dig +short nomas.site any

Open in new window


Same output for www.nomas.site, so you must first setup working DNS for your site.
Bruce GustPHP Developer

Author

Commented:
This is my localhost. This is not live.

My question is pertaining to what apparently is a discrepancy in the way I'm crafting the route itself. I think Chris is on to something. Sorry for the confusion...
Bruce GustPHP Developer

Author

Commented:
Guys, I own you an apology by citing my URL as though it were live and I'm sorry for leading you on that merry little goose chase.

The problem was in the I was structuring my route. Rather than building it according to a Larvel paradigm, I was assuming I had to include the "?" character etc.

This is what did the trick:

Route::get('/show/page/{id}', 'PageController@show')->name('adminShowPage'); //made sure to include the "/" character before the {id}

When I did that and then combined it with the...

 public function show($id)
    {
        //
            $page=Page::findOrFail($id);
            return view('/admin/showPage', compact('page'));
    }

...Controller, all was well.

Thanks for weighing in and know that there's going to be more questions.
Bruce GustPHP Developer

Author

Commented:
Wanted to award some credit for being available even if my question wasn't very well communicated.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial