1. Go to this page and download the library: Download ibrostudio/laravel-teamable library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ibrostudio / laravel-teamable example snippets
namespace App\Models;
use IBroStudio\Teamable\Concerns\IsTeamable;
use Illuminate\Database\Eloquent\Model;
class Company extends Model implements \IBroStudio\Teamable\Contracts\Teamable
{
use IsTeamable;
}
namespace App\Models;
use IBroStudio\Teamable\Concerns\HasTeams;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use HasTeams;
}
$user->getCurrentTeamId(TeamType::make(Company::class));
// or $user->getCurrentTeamId($company_1->team->type);
$user->getCurrentTeamId(TeamType::make(Department::class));
$user->switchToTeam($company_2->team);
$user->detachTeam($company->team);
bash
php artisan data-repository:install
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.