Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

foreignId in laravel

// for laravel 7 or above. 
$table->foreignId('user_id')->constrained();
/*-----------OR---------------*/
$table->foreignId('user_id')->constrained('users');
 
PREVIOUS NEXT
Tagged: #foreignId #laravel
ADD COMMENT
Topic
Name
1+9 =