I'm making a jobs website. Clients need to be able to search(checkbox input) the availability of contractors for certain days of the week.
I'm thinking about making a pivot table to store availability. ID column representing days of the week, Availability column showing true or false, and a user_id for the ID of the contractor.
I'm just not sure if it's the right way to do it. Wouldn't the user_id column have to store multiple user IDs? Can it be done?
Users migration:
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password', 255);
$table->string('address_address')->nullable();
$table->double('address_latitude')->nullable();
$table->double('address_longitude')->nullable();
$table->rememberToken();
$table->timestamps();
});
user_availability table:
Schema::create('user_availability', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('Days');
$table->foreign('user_id')
->references('id')
->on('users')
->onDelete('cascade');
});