samedi 26 décembre 2015

How to fix NotFoundHttpException laravel?

Hi all I am a new of laravel 5.1,I just start learning laravel. I have problame in laravel I can not find the way to correct it I try to search but I still can not.

And here is my code: CourseController.php

public function update(Request $request, $id)
    {
        $input = $request->all();
        $data = Course::findOrFail($id);
        $data->update($input);

        return redirect('course');
    }

and my model Course.php

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;



class Course extends Model
{
    protected $table = "course";
    protected $primaryKey = "course_id";

    protected $fillable=[
    'course_title',
    'course_code',
    'course_credite'
    ];
}

And here is my view edite.blade.php

<!DOCTYPE html>
<html>
<head>
    <title>Hello World</title>
    <link rel="stylesheet" type="text/css" href="">
</head>
<body>
<div class="container">
    {!! Form::open(array('route'=>['course.update','$course->course_id'],'class'=>'jack','method'=>'PUT')) !!}

    {!! Form::label('Course_title','Course Title',array('class'=>'aswe')) !!}
    {!! Form::text('course_title', $value=$course->course_title, $att = array('class'=>'blu','id'=>'single','required')) !!}

    {!! Form::label('Course_code','Code_title',array('class'=>'no')) !!}
    {!! Form::text('course_code',$value=$course->course_code,$att = array('class','blue','required')) !!}

    {!! Form::label('Course_creadit','creadit_title',array('class'=>'no')) !!}
    {!! Form::text('course_credite',$value=$course->course_credite,$att = array('class','blue','required')) !!}

    {!! Form::submit('submit',$att=array('class'=>'has')) !!}

    {!! Form::close() !!}
</div>
</body>
</html>

And my route

Route::resource('course','CourseController');



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire