външен ключ laravel
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();
});
външен ключ миграция laravel 5.6
Schema::table('posts', function (Blueprint $table) {
$table->unsignedInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
});
цяло число миграция laravel
$table->bigInteger('votes');
laravel хвърлят чуждестранна колона
// Searched, laravel drop foreign column
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['votes', 'avatar', 'location']);
});
типове полета laravel от типа на поле от базата данни
// in laravel if error of missing pdomysql driver issue the command
// composer require doctrine/dbal
DB::connection()->getDoctrineColumn($table_name, $field_name)->getType()->getName()
покажи гаф laravel blade
<td>{{ number_format($variable_name->price, 2) }}</td>