Laravel 5在大型数据库上失败了

I am following a simple ToDo list example to learn Laravel 5. I set up the code exactly as given, and for a small DB, the APP works perfectly.

The problem arose when I set up my custom seeds (large DB) (files attached below). When I set the project count to ~10-50, the APP works perfectly. Setting it in the ~1000+ range (1k projects, 100k tasks), I have to click (APP query URL) multiple times to even get a delete task to work. Standard methods delete, update fail, only store works. Any idea why?

I have verified using phpMyAdmin that the DB was set up correctly. I have also set up an Exception check when deleting.

EDIT: I find that store operation is working perfectly even on a 100k database. And if I delete something I just stored (using PHP app), it works. However, for the seeded entries, delete fails (at least 5 tries).

ProjectsTableSeeder.php

http://pastebin.com/HZrZNQgC

TasksTableSeeder.php

http://pastebin.com/uB03uTTa

TasksController.php

http://pastebin.com/xuACA29B

Original files (from tutorial) are here.

I believe you are trying to display too many records at once.

Try adding this to your index method.

public function index(Project $project) {
    return view('tasks.index', compact('project'))->paginate(20);;
}

You can display it in your view with.

{!! $project->appends(Request::except('page'))->render() !!}

I don't believe there is any more set up than that.

The documentation on pagination is pretty good.

If you haven't checked out Laracasts it is worth every dime.

Check out Crazy Simple Pagination for more about pagination.

I figured it out. Turns out I had mistakenly relied on Faker to generate 100k slugs, which was the problem. The multiple clicks for delete were actually different entries being deleted (:P).

I change the slug generating function from:

'slug' => $faker->firstName

to:

'slug' => $faker->firstName.$faker->lastName.rand(0, $BATCH_SIZE)

and now it works perfectly fine! Phew. (I had 1k projects, 1M tasks, and nearly no lag!)