itbm/laravel-jetstream-disable-personal-team 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

itbm/laravel-jetstream-disable-personal-team

最新稳定版本:1.1.2

Composer 安装命令:

composer require itbm/laravel-jetstream-disable-personal-team

包简介

Disable personal teams in Laravel Jetstream

README 文档

README

This package allows you to disable the personal teams in Laravel Jetstream.

Requirements

This package requires Laravel 10.x and Jetstream 2.x.

Installation

You can install the package via composer:

composer require itbm/laravel-jetstream-disable-personal-team

Usage

All

Update your CreateNewUser.php file to comment out the personal team creation logic:

return DB::transaction(function () use ($input) {
    return tap(User::create([
        'name' => $input['name'],
        'email' => $input['email'],
        'password' => Hash::make($input['password']),
    ]), function (User $user) {
        // $this->createTeam($user);
    });
});

Then, edit web.php and api.php to include the require-team middleware included with this package. This will redirect the user to the team creation page if they have not joined a team yet:

Route::middleware([
    'auth:sanctum',
    config('jetstream.auth_session'),
    'verified',
    'require-team',
])->group(function () {
    // ...
});

Inertia Only

You will need to update your AppLayout.vue file. Find and replace these 2 lines:

<Dropdown v-if="$page.props.jetstream.hasTeamFeatures" align="right" width="60">

<template v-if="$page.props.jetstream.hasTeamFeatures">

with:

<Dropdown v-if="$page.props.jetstream.hasTeamFeatures && $page.props.auth.user.current_team" align="right" width="60">

<template v-if="$page.props.jetstream.hasTeamFeatures && $page.props.auth.user.current_team">

Livewire Only

You will need to update your navigation-menu.blade.php file. Find and replace both instances of this line:

@if (Laravel\Jetstream\Jetstream::hasTeamFeatures())

with:

@if (Laravel\Jetstream\Jetstream::hasTeamFeatures() && Auth::user()->currentTeam)

统计信息

  • 总下载量: 1.95k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-13