<?php

use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;
use Illuminate\Database\Migrations\Migration;

class AddTrainerRole extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        // Reset cached roles and permissions
        app()['cache']->forget('spatie.permission.cache');

        $role = Role::firstOrCreate(['name' => 'trainer']);
        $role->givePermissionTo('create-attendance');
        $role->givePermissionTo('read-teams-hidden');
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Role::where('name', 'trainer')->first()->delete();
    }
}

Add migration to add trainer role
Add migration to add trainer role

Trainers can add attendance to hidden teams
