Ad
Laravel Multi Profile Types
I have two members type it's player and venue how i can better create tables? Maybe players with user_id
or merge users
table and players
? but what about then venues
table?
Ad
Answer
You may create new migration, using the migrate:make
command on the Artisan CLI. Use a specific name to avoid clashing with existing models
php artisan make:migration add_type_to_users_table --table=users
You then need to use the Schema::table() method (as you're accessing an existing table, not creating a new one). And you can add a column like this:
public function up()
{
Schema::table('users', function($table) {
$table->enum('type', ['player', 'venue'])->after('email');
});
}
and don't forget to add the rollback option:
public function down()
{
Schema::table('users', function($table) {
$table->dropColumn('type');
});
}
Then you can run your migrations:
php artisan migrate
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad