-
app/Models/Workspace.php
Open in GitHubclass Workspace extends Model { // public function users() { return $this->belongsToMany(User::class); } public function owners() { return $this->users()->wherePivot('role', 'admin'); } // }
-
database/migrations/2022_09_12_074636_remove_access_token_from_workspaces.php
Open in GitHubuse Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { public function up() { Schema::table('user_workspace', function (Blueprint $table) { $table->dropColumn('access_token'); $table->dropColumn('is_owner'); $table->string('role')->default('admin'); }); } // }