$table- unique laravel
Schema::table('posts', function (Blueprint $table) {
$table->unsignedInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
});Schema::table('tableName', function($table)
{
$table->string('column-name')->unique(); //notice the parenthesis I added
});Schema::table('posts', function (Blueprint $table) {
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
});
OR
Schema::table('posts', function (Blueprint $table) {
$table->foreignId('user_id')->constrained();
});
Also in PHP:
- $this in catch block php
- @auth laravel
- change readble date format in php
- datetime php now
- add one day to a date in php
- creat folder in php
- __dir__ in php
- Parse error</b>: syntax error, unexpected ':', expecting ';' or '{' in <b>//twilio-php-master/src/Twilio/autoload.php</b> on line <b>61</b><br />
- get current date and time php
- Adding code to header tag php website
- convert request image as base64 string php
- built in functions in php for uppercase
- 500 server error laravel 7
- all uppercase in php
- array exists in php
- create random unique password with php
- : 1071 Specified key was too long; max key length is 767 bytes (SQL: alter tabl e `users` add unique `users_email_unique`(`email`))
- check if string contains a string php
- cahgne date format in php
- datetimepicker format php
- array reverse in php example
- date time to date php
- am pm date format php
- basic code for file upload in php