public function postAdd() {
         
        if(Request::ajax()){
            $task = new Task();
            $task->title = Input::get("title");
            $task->save();
            $last_task = $task->id;
            $tasks = task::whereId($last_task)->get();
            return View::make("ajaxData")->with("tasks", $tasks);
        }
    }
 
    public function postUpdate($id) {
         
        if(Request::ajax())
        {
            $task = Task::find($id);
            $task->title = Input::get("title");
            $task->save();
            return "OK";
        }
    }
Hosted with ❤ by CODENEXT view on codenext