title: Laravel Api update and delete function
body: <p>I'm building an API, i'm getting the following error while updating and deleting from table i'm using postman to test my api</p>
  
  <pre><code>    //update error
  QueryException in Connection.php line 770:
  SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'title' cannot be null (SQL: update `lessons` set `title` = , `body` = , `completed` = , `updated_at` = 2017-01-03 09:14:10 where `id` = 11)
  
  //delete error
  FatalErrorException in LessonsController.php line 80:
  Call to a member function delete() on null
  </code></pre>
  
  <p>My controller LessonsController</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Response;
  use App\lesson;
  use Illuminate\Http\Request;
  use App\Acme\Transformers\LessonTransformer;
  use Illuminate\Support\Facades\Input;
  
  class LessonsController extends ApiController {
  
      protected $lessonTransformer;
  
      function __construct(LessonTransformer $lessonTransformer) {
  
          $this-&gt;lessonTransformer = $lessonTransformer;
  
      }
  
      //fetch all and pass a metadata 'data' 
      public function index() {
  
          $lessons = Lesson::all();
  
          return $this-&gt;respond([
  
              'data' =&gt; $this-&gt;lessonTransformer-&gt;transformCollection($lessons-&gt;all())
  
          ]);
      }
  
  
      //fetch by id
      public function show($id) {
  
          $lesson = Lesson::find($id);
  
          if(! $lesson) {
  
              return $this-&gt;respondNotFound();
  
          }
  
          return $this-&gt;respond([
  
              'data' =&gt; $this-&gt;lessonTransformer-&gt;transform($lesson)
  
          ]);
      }
  
  
      public function store() {
  
          if (! input::get('title') or ! input::get('body')) {
              return $this-&gt;respondBadRequest();
          }
  
          Lesson::create(input::all());
  
          return $this-&gt;respondCreated();
  
      }
  
  
      public function update(Request $request, $id) {
  
          $ulesson = Lesson::find($id);
  
          $ulesson-&gt;title = $request-&gt;input('title');
          $ulesson-&gt;body = $request-&gt;input('body');
          $ulesson-&gt;completed = $request-&gt;input('completed');
          $ulesson-&gt;save();
  
          return "Sucess updating user #" . $ulesson-&gt;id;
      }   
  
  
      public function destroy(Request $request) {
          $dlesson = Lesson::find($request-&gt;input('id'));
  
          $dlesson-&gt;delete();
  
          return "Employee record successfully deleted #" . $request-&gt;input('id');
      }
  
  }
  </code></pre>
  
  <p>my model Lesson</p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class Lesson extends Model
  {
      protected $fillable = ['title', 'body', 'completed',];
  
      //protected $hidden =['title'];
  }
  </code></pre>
  
  <p>the store and other functions are working fine</p>
  
  <p>Thank You</p>