Questions tagged [laravel-schema-builder]
21 questions
0
votes
1 answer
Laravel 5.8 Schema adding foreign key not working
I'm trying to create foreign keys in Laravel 5.8 and when I migrate my table using Artisan the foreign key not set. In the cities table and provinces table, all id fields are unsigned integers. I'm working with wamp64 on Windows 10.
public function…

nimanima2011
- 23
- 4
0
votes
1 answer
Laravel DB Schema when referencing to two tables
There a able, called 'interests' which hold the id(s) of 'categories' and/or 'brands' that each user has interest in.
To prevent creating two separate tables for user_category_interests and user_brand_interest I added an enum column called type.
Now…

Hadi Sharghi
- 903
- 16
- 33
0
votes
1 answer
How to create a self-reference relationship (foreign key) in a Laravel migration?
I am starting with a self-learning project built on top of Laravel 5.2 and I have found my first issue: self-reference in a migration.
This is how the file 2016_08_02_024942_create_navigation_table.php looks like (I have remove the comments for not…

ReynierPM
- 17,594
- 53
- 193
- 363
0
votes
1 answer
How to set the default value of an integer field to it's possible maximum?
Is there any way to set a maximum value as a default one for an integer field? In other words, I'm looking for a simple and elegant way to replace the hardcoded 999 value from the code below.
Schema::create('files', function(Blueprint $table)
{
…

Alex Lomia
- 6,705
- 12
- 53
- 87
0
votes
1 answer
How to add selected item into mysql database Laravel Schema Builder?
I used webpatser/laravel-countries
in my controlleer
$countries= DB::table('countries')->lists('name');
to select country list in my form i got all the country
{!! Form::select('country',$countries,null) !!}
in my schema now i have like…

Prudential Developer
- 157
- 2
- 13
0
votes
1 answer
Laravel Migration Failed
I'm having a bit of trouble with Laravel Migrations. I've recently stopped developing on C9 and decided to try out Nitrous.io instead - however I'm unsure whether my error is related to this. I also decided to change from sqlite to mysql. Since I'm…

Kim Ward
- 142
- 1
- 10