Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve foreign key generator based on Laravel 7 #188

Open
amirmojiry opened this issue Aug 24, 2020 · 0 comments
Open

Improve foreign key generator based on Laravel 7 #188

amirmojiry opened this issue Aug 24, 2020 · 0 comments

Comments

@amirmojiry
Copy link

  • Laravel Version: 7.2.4
  • PHP Version: 7.4
  • Laravel-5-Generators-Extended Version: 1.1
  • Command: php artisan make:migration:pivot

In Laravel 7, isn't it better to write this line:
$table->foreignId('tableOne_id')->constrained()->onDelete('cascade');

instead of these lines:

$table->integer('tableOne_id')->unsigned()->index();
$table->foreign('tableOne_id')->references('id')->on('tableOnes')->onDelete('cascade');

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant