app/Repositories/TeamRepository.php
public function create($user, array $data)
    {
        $team = $user->teams()->create(
            ['name' => $data['name']], ['role' => 'owner']
        );

        $team->owner_id = $user->id;

        $team->save();

        return $team;
    }
public function create($user, array $data)
    {
        $team = $user->teams()->create(
            ['name' => $data['name']], ['role' => 'owner']
        );

        $team->owner_id = $user->id;

        $team->save();

        return $team;
    }
Create a new team for the given user and data.

@param  \Illuminate\Contracts\Auth\Authenticatable  $user
@param  array  $data
@return \Laravel\Spark\Teams\Team