Support the ongoing development of Laravel.io →
Requests Views Blade

Hi there

I am new on this forum so I would like to say Hi first.

I am working with Laravel 4. Making a simple project which includes routes. The problem occured not a long time ago. I haven't made any major changes to the code.

I can't really say what the real problem is, I just can't get one of my functions to get working because it throws out an error:

Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException

The point of this wbesite function is to update data from the database. So, it gets already saved data, puts it in to the text box and allows the user to change the data and update it back to the database under the same ID.

I know, in other words this means 404 page not found and there is a problem with my routing. I cannot find a real answer to this problem. I have tried configuring apache's server file however this haven't changed anything.

This problem also occured in one of my other similar function which was working perfect but now it shows the same error.

So the blade looks like this (views\admin\types\edit.blade.php):

@extends('layouts.master')

{{-- Title --}}
@section('title', 'Admin')

{{-- Content --}}
@section('content')
<div id ="type-edit">
    {{ Form::open(array('route' => array('admin.type.update'), 'files' => 'true')); }}
    <div class="row">
        <div class="col-md-offset-3 col-md-6">
            <div class="row">
                <div class="col-md-12">    
                    {{ Form::textField('new_type', 'Type Name',$type->TypeName); }}
                </div>
            </div>
            {{ Form::submit('Update Type', array('class' => 'btn btn-primary btn-block btn-lg')); }}
        </div>
    </div>
{{ Form::Close() }}
</div>
@stop

{{-- JavaScripts --}}
@section('scripts')

@stop

Here is my routing:

/**
    #Edit Types
     **/
    Route::get('/type/{id}/edit', array(
        'as' => 'admin.type.edit',
        'uses' => 'TypesController@getEditType'
    ))->where('id', '[0-9]+');


    Route::post('/type/{id}/update', array(
            'before'  => 'csrf',
            'as' => 'admin.type.update',
            'uses' => 'TypesController@postEditType'
        ))->where('id', '[0-9]+');

Here is the controller functions (TypesController.php):

class TypesController extends BaseController
{
     public function getEditType($id)
      {
            $type = Type::findOrFail($id);

             return View::make('admin.types.edit', compact('type'));
      }

      public function postEditType($id)
      {
            $type = Type::find($id);
            $type->TypeName = Input::get('new_type');
            $type->save();

            return Redirect::route('admin.types.list');
      }
}

Here is the model(Type.php):

class Type extends Eloquent 
{

	
	protected $table = 'types';
    
    
	protected $primaryKey = 'TypeID';

        public $timestamps = true;

}

To get more infromation about the problem I added this code to global.php:


App::missing(function($e) {
	$url = Request::fullUrl();
	$userAgent = Request::header('user-agent');
	Log::warning("404 for URL: $url requested by user agent: $userAgent");
	return Response::view('errors.not-found', array(), 404);
});

With this code inside global.php the error is:

Error in exception handler: View [errors.not-found] not found. in /var/www/domain.com/htdocs/proj/bootstrap/compiled.php:9499

Other website's functions work fine. I am testing my website on Ubuntu VPS.

Thanks.

Last updated 2 years ago.
0

Anyone??

0

Error in exception handler: View [errors.not-found] not found...

This is saying it cannot find the view file which using defaults would be in resources/views/errors/not-found.blade.php

What route url gives the error?

0

Ok, so I know that this error refers to the function which I have added to global.php. We can ignore that for the moment. My bad for not noticing that.

Any idea, for the other problem? I am still struggling with it. It still throws out NotFoundHttpException for this function which I have made. Others work fine.

0

Check your routes.php it seems the problem is there,

0

Everything in routes.php looks alright to me. I've got the correct namings etc. This is why I am worried about. It should work fine.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

empesis empesis Joined 26 Jan 2016

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.

© 2025 Laravel.io - All rights reserved.