Search
 
SCRIPT & CODE EXAMPLE
 

PHP

foreignId in laravel

// for laravel 7 or above. 
$table->foreignId('user_id')->constrained();
/*-----------OR---------------*/
$table->foreignId('user_id')->constrained('users');
Comment

PREVIOUS NEXT
Code Example
Php :: laravel storage get file path 
Php :: laravel curl request 
Php :: absolute path php 
Php :: carbon last day of month in timestamp 
Php :: laravel old request 
Php :: image uploading and validation php 
Php :: php ziparchive compress folder 
Php :: artisan commands in route 
Php :: a facade root has not been set laravel 
Php :: [!] No podspec found for package_name in path_to_package... 
Php :: eloquent get distinct 
Php :: laravel run seeder 
Php :: php isset ternary operator 
Php :: This page isn’t working php 
Php :: deactivate plugin wp cli 
Php :: PHP Numeric String 
Php :: Target class [Controller] does not exist. 
Php :: Laravel Boot strap Pagination 
Php :: php top frameworks 
Php :: How can I get current controller and current controller action name in yii2 
Php :: php array json encode key and value 
Php :: laravel required_with 
Php :: if condition inside echo in php 
Php :: laravel redirect back with errors and input 
Php :: laravel 404 
Php :: how to use where relationship laravel 
Php :: E: Unable to locate package php8.0 
Php :: Flutter migrate to Android Studio mac os 
Php :: faker laravel 
Php :: shortcut vsc select line up 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =