Support the ongoing development of →
posted 8 years ago
Last updated 1 year ago.

I don't think the

php artisan generate:pivot players teams

exists in Laravel 5 as it used to in Laravel 4.

Hopefully however, this may help. This is how I create pivot tables in Laravel 5 with foreign key constraints:

php artisan make:migration create_player_team_table --table=player_team

The most important thing is to ensure your player_team table name is in alphabetical order with singular table names, i.e. do not use teams_players (not alphabetical), and do not use something like, player_teams (the plural teams will break it.)

The following gives an example of how the resulting


up() function might look:

    * Run the migrations.
    * @return void
    public function up()
        Schema::create('player_team', function(Blueprint $table)


Obviously, you can include or exclude the foreign key cascading deletes if you wish, I include them here only as a pointer.

I hope this helps.

Last updated 8 years ago.

EDIT: In the doc of this package, the command is :

php artisan make:migration:pivot tags posts
Last updated 8 years ago.

Couldn't list the the pivot method in bash

I do however this error, probably because i have already set this up.

$ composer require laracasts/generators --dev Using version ^1.1 for laracasts/generators ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Nothing to install or update Generating autoload files

[Symfony\Component\Debug\Exception\FatalErrorException] Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()

Script php artisan clear-compiled handling the post-update-cmd event returned with an error

[RuntimeException] Error Output:

require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--sort-packages] [packages1] ... [packagesN]


Sign in to participate in this thread!


Your banner here too?

AdrianLove adrianlove Joined 16 Feb 2015


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2023 - All rights reserved.