### Install NPM and Run Development Build Source: https://docs.larafast.com/fast-projects/directories/intro Install Node.js dependencies and compile frontend assets for development. ```bash npm install npm run dev ``` -------------------------------- ### Example .env File Structure Source: https://docs.larafast.com/multi-tenancy/settings/general-settings This is an example of how your .env file might be structured with various application settings. ```env APP_NAME="My SaaS App" APP_ENV=production APP_DEBUG=false APP_URL=https://myapp.com MAIL_FROM_ADDRESS=noreply@myapp.com MAIL_FROM_NAME="${APP_NAME}" AUTH_REGISTRATION_ENABLED=true AUTH_EMAIL_VERIFICATION_REQUIRED=true ``` -------------------------------- ### Install Larafast Installer Source: https://docs.larafast.com/larafast-installer Run this command in your terminal to download and execute the Larafast installer script. Replace `[YOUR_PROJECT_NAME]` with your desired project name. ```bash curl -s -O https://larafast.com/install && bash install [YOUR_PROJECT_NAME] ``` -------------------------------- ### Create .env File Source: https://docs.larafast.com/fast-projects/api/intro Copy the example environment file to create your own .env configuration file. ```bash cp .env.example .env ``` -------------------------------- ### Clone Repo and Install Composer Source: https://docs.larafast.com/fast-projects/directories/intro Clone the project repository and install Composer dependencies. ```bash git clone git@github.com:karakhanyans-tools/larafast-directories.git [YOUR_PROJECT_NAME] cd [YOUR_PROJECT_NAME] composer install ``` -------------------------------- ### Complete App Panel Provider Example Source: https://docs.larafast.com/multi-tenancy/configuration/panel-setup A comprehensive example of an App Panel Provider demonstrating multi-tenancy configuration, including tenant model, registration, profile, middleware, and billing. ```php default() ->id('app') ->path('app') ->login() ->registration() ->passwordReset() ->emailVerification() ->profile() ->colors([ 'primary' => Color::Amber, ]) ->discoverResources(in: app_path('Filament/App/Resources'), for: 'App\\Filament\\App\\Resources') ->discoverPages(in: app_path('Filament/App/Pages'), for: 'App\\Filament\\App\\Pages') ->discoverWidgets(in: app_path('Filament/App/Widgets'), for: 'App\\Filament\\App\\Widgets') ->middleware([ // ... standard middleware ]) ->authMiddleware([ Authenticate::class, ]) // Multi-tenancy configuration ->tenant(Team::class, ownershipRelationship: 'teams') ->tenantRegistration(RegisterTeam::class) ->tenantProfile(EditTeamProfile::class) ->tenantMiddleware([ UpdateUserCurrentTeam::class, ], isPersistent: true) ->tenantBillingProvider(new \Filament\Billing\Providers\StripeBillingProvider()) ->requiresTenantSubscription(false); } } ``` -------------------------------- ### Install NPM Dependencies and Build Assets Source: https://docs.larafast.com/tutorials/zero-downtime-deployment-with-laravel-forge Installs NPM dependencies using npm install and then builds the application's JavaScript assets using npm run build. ```bash printf '\nℹ️ Installing NPM dependencies based on \"./package-lock.json\"\n' npm install printf '\nℹ️ Generating JS App files\n' npm run build ``` -------------------------------- ### ProductSeeder.php Example Source: https://docs.larafast.com/fast-projects/directories/features/products An example of the `ProductSeeder` class, demonstrating how to define and create products programmatically. It associates products with an admin user. ```php 'Larafast', 'logo_url' => 'https://placehold.co/400', 'description' => 'Laravel SaaS Starter Kit', 'short_description' => 'Laravel SaaS Starter Kit', 'URL' => 'https://larafast.com', 'active' => true, ], ]; $user = User::role('admin')->first(); foreach ($products as $product) { $user->products()->create($product); } } } ``` -------------------------------- ### Complete Pricing Plans Example Source: https://docs.larafast.com/multi-tenancy/pricing/plans-configuration Provides a comprehensive example of defining multiple pricing plans (Free, Starter, Pro) for Stripe, including their respective details and features. ```php [ // Free Plan [ 'name' => 'Free', 'slug' => 'free', 'description' => 'Perfect for individuals and small teams getting started', 'price' => 0, 'interval' => 'month', 'features' => [ 'Up to 3 projects', '5 team members maximum', 'Basic collaboration tools', '1GB file storage', 'Email support', 'Mobile app access', ], ], // Starter Plan (Most Popular) [ 'name' => 'Starter', 'slug' => 'price_1234567890starter', // Your Stripe Price ID 'description' => 'Ideal for growing teams that need more power', 'price' => '29.99', 'interval' => 'month', 'features' => [ 'Everything in Free', 'Unlimited projects', 'Unlimited team members', 'Advanced collaboration', 'Priority email support', '50GB file storage', 'Custom integrations', 'Advanced analytics', ], 'bestseller' => true, // Shows "Most Popular" badge ], // Pro Plan [ 'name' => 'Pro', 'slug' => 'price_1234567890pro', // Your Stripe Price ID 'description' => 'For large organizations with advanced needs', 'price' => '99.99', 'interval' => 'month', 'features' => [ 'Everything in Starter', 'Dedicated account manager', '24/7 phone support', '500GB file storage', 'Custom onboarding', 'SLA guarantee (99.9%)', 'Advanced security features', 'API access', 'White-label options', ], ], ], ]; ``` -------------------------------- ### Install Browsershot and Puppeteer Source: https://docs.larafast.com/features/seo/og-images Install the required Spatie Browsershot and Puppeteer packages using Composer and npm. ```bash composer require "spatie/browsershot" composer require "spatie/image" npm install puppeteer ``` -------------------------------- ### Updating .env File Example Source: https://docs.larafast.com/multi-tenancy/settings/environment-management Demonstrates how the EnvManager updates a specific key while preserving other content. ```php // Before APP_NAME="Old Name" // After $envManager->set('APP_NAME', 'New Name') APP_NAME="New Name" ``` -------------------------------- ### Default .env.example Settings Source: https://docs.larafast.com/multi-tenancy/settings/overview Shows the default settings present in the `.env.example` file upon initial installation of Larafast Multi-Tenancy. ```dotenv APP_NAME=Larafast APP_ENV=local APP_DEBUG=true APP_URL=http://localhost MAIL_FROM_ADDRESS="hello@example.com" AUTH_USE_SOCIAL_AUTH=true AUTH_REGISTRATION_ENABLED=true ``` -------------------------------- ### GitHub Service Configuration Example Source: https://docs.larafast.com/multi-tenancy/settings/social-authentication Example configuration for GitHub OAuth in `config/services.php`. Ensure your .env file contains the corresponding GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET. ```php 'github' => [ 'client_id' => env('GITHUB_CLIENT_ID'), 'client_secret' => env('GITHUB_CLIENT_SECRET'), 'redirect' => '/auth/callback/github', ], ``` -------------------------------- ### Install Larafast with Alias Source: https://docs.larafast.com/larafast-installer Once the alias is set up, you can install Larafast boilerplates using this simplified command. ```bash larafast [YOUR_PROJECT_NAME] ``` -------------------------------- ### Basic Tenant Setup in App Panel Source: https://docs.larafast.com/multi-tenancy/configuration/panel-setup Configure the App panel to use a specific tenant model and define the ownership relationship. ```php use App\Models\Team; use Filament\Panel; public function panel(Panel $panel): Panel { return $panel ->id('app') ->path('app') ->tenant(Team::class, ownershipRelationship: 'teams') // ... other configuration } ``` -------------------------------- ### Run Local Server Source: https://docs.larafast.com/fast-projects/api/intro Start the local development server using Laravel's Artisan command. ```bash php artisan serve ``` -------------------------------- ### Full Zero Downtime Deployment Script Source: https://docs.larafast.com/tutorials/zero-downtime-deployment-with-laravel-forge A comprehensive bash script that automates the entire zero-downtime deployment process, including setup, cloning, environment configuration, dependency installation, asset building, and linking. ```bash # SETUP # DOMAIN=yourdomain.com PROJECT_REPO="git@github.com:your-team/repo.git" AMOUNT_KEEP_RELEASES=5 RELEASE_NAME=$(date +%s--%Y_%m_%d--%H_%M_%S) RELEASES_DIRECTORY=~/$DOMAIN/releases DEPLOYMENT_DIRECTORY=$RELEASES_DIRECTORY/$RELEASE_NAME # stop script on error signal (-e) and undefined variables (-u) set -eu printf '\nℹ️ Starting deployment %s\n' "$RELEASE_NAME" cd /home/forge/$DOMAIN mkdir -p "$RELEASES_DIRECTORY" && cd "$RELEASES_DIRECTORY" printf '\nℹ️ Clone GIT project from %s and checkout branch %s\n' "$PROJECT_REPO" "$FORGE_SITE_BRANCH" git clone "$PROJECT_REPO" "$RELEASE_NAME" cd "$RELEASE_NAME" git checkout "$FORGE_SITE_BRANCH" git fetch origin "$FORGE_SITE_BRANCH" git reset --hard FETCH_HEAD printf '\nℹ️ Copy ./.env file\n' ENV_FILE=~/"$DOMAIN"/.env if [ -f "$ENV_FILE" ]; then cp $ENV_FILE ./.env else printf '\nError: .env file is missing at %s.' "$ENV_FILE" && exit 1 fi $FORGE_COMPOSER install --no-dev --no-interaction --prefer-dist --optimize-autoloader ( flock -w 10 9 || exit 1 echo 'Restarting FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9>/tmp/fpmlock if [ -f artisan ]; then $FORGE_PHP artisan migrate --force fi printf '\nℹ️ Installing NPM dependencies based on \"./package-lock.json\"\n' npm install printf '\nℹ️ Generating JS App files\n' npm run build printf '\nℹ️ !!! Link Deployment Directory !!!\n' echo "$RELEASE_NAME" >> $RELEASES_DIRECTORY/.successes if [ -d ~/"."$DOMAIN"/current" ] && [ ! -L ~/"."$DOMAIN"/current" ]; then rm -rf ~/"."$DOMAIN"/current" fi ln -s -n -f -T "$DEPLOYMENT_DIRECTORY/public" ~/"."$DOMAIN"/current" ``` -------------------------------- ### Install Larafast CLI Source: https://docs.larafast.com/ Run this command in your terminal to download and execute the Larafast installer script. Replace `[YOUR_PROJECT_NAME]` with your desired project name. ```bash curl -s -O https://larafast.com/install && bash install [YOUR_PROJECT_NAME] ``` -------------------------------- ### Annual Plan Example Source: https://docs.larafast.com/multi-tenancy/pricing/plans-configuration Demonstrates how to configure an annual billing plan, offering a cost saving compared to the monthly equivalent. ```php [ 'name' => 'Starter Annual', 'slug' => 'price_annual_starter', 'price' => '299.99', // ~$25/month, saves $60/year 'interval' => 'year', ] ``` -------------------------------- ### Clone Repo and Install Composer Source: https://docs.larafast.com/intro-vilt Clone the Larafast repository and install Composer dependencies. Replace `[YOUR_PROJECT_NAME]` with your desired project name. ```bash git clone git@github.com:karakhanyans-tools/larafast.git [YOUR_PROJECT_NAME] cd [YOUR_PROJECT_NAME] composer install ``` -------------------------------- ### Start Queue Worker Source: https://docs.larafast.com/multi-tenancy/custom-domains/setup-guide Run this command to start a queue worker that processes background jobs, such as domain verification. ```bash php artisan queue:work ``` -------------------------------- ### Clone Repo and Install Composer Source: https://docs.larafast.com/multi-tenancy/intro Clone the Larafast Multi-Tenancy repository and install Composer dependencies. Replace '[YOUR_PROJECT_NAME]' with your desired project name. ```bash git clone git@github.com:karakhanyans-tools/larafast-multitenancy.git [YOUR_PROJECT_NAME] cd [YOUR_PROJECT_NAME] composer install ``` -------------------------------- ### Bestseller Flag Example Source: https://docs.larafast.com/multi-tenancy/pricing/plans-configuration Shows how to mark a specific plan as the 'bestseller' using a boolean flag. ```php 'bestseller' => true, ``` -------------------------------- ### Example .env File Format Source: https://docs.larafast.com/multi-tenancy/settings/environment-management The .env file uses a simple key=value pair format, supporting comments and blank lines. ```dotenv # Application Settings APP_NAME="My SaaS App" APP_ENV=production APP_DEBUG=false APP_URL=https://myapp.com # Database DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_DATABASE=mydb # Mail MAIL_MAILER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_FROM_ADDRESS=noreply@myapp.com # Social Auth GITHUB_CLIENT_ID=abc123 GITHUB_CLIENT_SECRET=xyz789 ``` -------------------------------- ### Create a New Team Source: https://docs.larafast.com/multi-tenancy/database/teams-table Example of creating a new team record in the database. ```php use App\Models\Team; $team = Team::create([ 'name' => 'Acme Corporation', 'description' => 'Our main business team', 'owner_id' => auth()->id(), ]); ``` -------------------------------- ### Automatic Scoping Examples Source: https://docs.larafast.com/multi-tenancy/resources/creating-resources Demonstrates how queries to tenant-scoped resources are automatically filtered to return only the current team's projects without explicit `where` clauses. ```php // Only returns current team's projects Project::all(); Project::where('status', 'active')->get(); Project::latest()->limit(10)->get(); ``` -------------------------------- ### Listen for LemonSqueezy Webhooks (Development) Source: https://docs.larafast.com/features/payments/lemonsqueezy Starts a local server to listen for and process LemonSqueezy webhook events during development. This command automatically sets up and cleans up webhooks. ```bash php artisan lmsqueezy:listen ``` -------------------------------- ### Complete User Model for Multi-Tenancy Source: https://docs.larafast.com/multi-tenancy/configuration/user-model A comprehensive example of the User model implementing all required interfaces and methods for Filament multi-tenancy, including all relationships. ```php allTeams(); } public function canAccessTenant(Model $tenant): bool { return $this->allTeams()->contains($tenant); } public function getDefaultTenant(Panel $panel): ?Model { return $this->currentTeam ?? $this->allTeams()->first(); } public function canAccessPanel(Panel $panel): bool { if ($panel->getId() === 'admin') { return $this->hasRole('admin'); } return true; } public function allTeams(): Collection { return $this->teams() ->union($this->ownedTeams()->toBase()) ->orderBy('created_at', 'desc') ->get(); } public function teams(): BelongsToMany { return $this->belongsToMany(Team::class) ->withTimestamps(); } public function ownedTeams(): HasMany { return $this->hasMany(Team::class, 'owner_id'); } public function currentTeam(): BelongsTo { return $this->belongsTo(Team::class, 'current_team_id'); } } ``` -------------------------------- ### Run Laravel Commands Source: https://docs.larafast.com/tutorials/zero-downtime-deployment-with-laravel-forge Installs Composer dependencies, optimizes the autoloader, restarts PHP-FPM, and runs database migrations if an artisan file exists. ```bash $FORGE_COMPOSER install --no-dev --no-interaction --prefer-dist --optimize-autoloader ( flock -w 10 9 || exit 1 echo 'Restarting FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9>/tmp/fpmlock if [ -f artisan ]; then $FORGE_PHP artisan migrate --force fi ``` -------------------------------- ### Retry Certificate Provisioning Source: https://docs.larafast.com/multi-tenancy/custom-domains/ssl-certificates Use an artisan command to check and fix custom domain setup issues, including retrying certificate provisioning. ```bash php artisan app:check-custom-domain-setup ``` -------------------------------- ### Start Queue Worker for Development Source: https://docs.larafast.com/multi-tenancy/custom-domains/setup-guide Run this command in your development environment to process background jobs. Adjust the number of tries as needed. ```bash php artisan queue:work --tries=3 ``` -------------------------------- ### A Record (IPv4) Example Source: https://docs.larafast.com/multi-tenancy/custom-domains/dns-configuration Configure an A record to point your custom domain or subdomain directly to your server's IPv4 address. Use '@' for the root domain. ```dns Type: A Name: app (or @ for root domain) Value: 203.0.113.42 TTL: 3600 ``` -------------------------------- ### DNS Verification Example Source: https://docs.larafast.com/multi-tenancy/custom-domains/dns-configuration This PHP code snippet demonstrates how the system performs a DNS lookup to verify if a custom domain points to the correct server IP address. ```php // Example of what the system checks $dnsRecords = dns_get_record('app.clientdomain.com', DNS_A); // Verifies if any record matches your server's IP ``` -------------------------------- ### Laravel Envoy Deployment Script Source: https://docs.larafast.com/deploy/deploy-with-envoy An example Envoy.blade.php file demonstrating a full deployment workflow. It includes tasks for fetching code, installing dependencies, running migrations, and clearing cache. ```blade @servers(['web' => ['user@your-server-ip-address']]) {{--Set up the branch and project folder--}} @setup $branch = 'master'; $folder = '/home/user/project_folder'; @endsetup @story('deploy') git composer artisan npm @endstory {{--Update the project from the repository--}} @task('git', ['on' => 'web']) cd {{ $folder }} git fetch --all git reset --hard origin/{{ $branch }} @endtask {{--Install the composer dependencies--}} @task('composer', ['on' => 'web']) cd {{ $folder }} composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader @endtask {{--Run the migrations and clear the cache--}} @task('artisan', ['on' => 'web']) cd {{ $folder }} php artisan migrate --force php artisan cache:clear php artisan generate:sitemap @endtask {{--Install the npm dependencies and build the assets--}} @task('npm', ['on' => 'web']) cd {{ $folder }} npm install npm run build @endtask {{--Notify the team on Slack for successful deployment--}} @success @slack('webhook-url', '#bots') @endsuccess {{--Notify the team on Slack for failed deployment--}} @error @slack('webhook-url', '#bots') @enderror ``` -------------------------------- ### Create and Restore .env Backup Source: https://docs.larafast.com/multi-tenancy/settings/environment-management Demonstrates creating a backup of the .env file before making changes and restoring it if an error occurs. ```PHP // Create backup copy('.env', '.env.backup'); // Make changes $envManager->set('APP_NAME', 'New Name'); // Restore if something goes wrong if ($error) { copy('.env.backup', '.env'); } ``` -------------------------------- ### Production Deployment Commands Source: https://docs.larafast.com/deploy/deploy-to-prod Run these commands in your production environment after setting up your .env file and purchasing a hosting provider. These commands install dependencies, generate keys, migrate the database, create an admin user, and build frontend assets. ```bash composer install php artisan key:generate php artisan migrate php artisan make:admin // to create admin user npm install npm run build ``` -------------------------------- ### Install LemonSqueezy Laravel Package Source: https://docs.larafast.com/tutorials/lemonsqueezy-webhooks-for-non-auth-users Install the official LemonSqueezy package for Laravel using Composer. Refer to the official documentation for complete installation steps. ```bash composer require lmsqueezy/laravel ``` -------------------------------- ### Initialize Deployment Variables Source: https://docs.larafast.com/tutorials/zero-downtime-deployment-with-laravel-forge Sets up essential variables for the deployment process, including domain, repository, and release count. ```bash DOMAIN=example.com PROJECT_REPO="your_github_repo_name" AMOUNT_KEEP_RELEASES=5 RELEASE_NAME=$(date +%s--%Y_%m_%d--%H_%M_%S) RELEASES_DIRECTORY=~/$DOMAIN/releases DEPLOYMENT_DIRECTORY=$RELEASES_DIRECTORY/$RELEASE_NAME ``` -------------------------------- ### Configure Database and Run Migrations Source: https://docs.larafast.com/multi-tenancy/intro Set your database connection details in the .env file. By default, SQLite is used. To use MySQL, update DB_CONNECTION and provide your database credentials. Then, run the database migrations. ```dotenv DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=your_db_name DB_USERNAME=root DB_PASSWORD= ``` ```bash php artisan migrate ``` -------------------------------- ### Run Migrations Source: https://docs.larafast.com/intro-vilt Apply database migrations to set up your database schema. ```bash php artisan migrate ``` -------------------------------- ### Clone Repo and Install Composer Source: https://docs.larafast.com/fast-projects/api/intro Clone the Larafast API Boilerplate repository and install its dependencies using Composer. ```bash git clone git@github.com:karakhanyans-tools/larafast-rest-api.git [YOUR_PROJECT_NAME] cd [YOUR_PROJECT_NAME] composer install ``` -------------------------------- ### Clone Repository and Set Up Release Directory Source: https://docs.larafast.com/tutorials/zero-downtime-deployment-with-laravel-forge Creates a new release directory and clones the project repository into it, then checks out the specified branch and resets to the latest commit. ```bash cd /home/forge/$DOMAIN mkdir -p "$RELEASES_DIRECTORY" && cd "$RELEASES_DIRECTORY" git clone "$PROJECT_REPO" "$RELEASE_NAME" cd "$RELEASE_NAME" git checkout "$FORGE_SITE_BRANCH" git fetch origin "$FORGE_SITE_BRANCH" git reset --hard FETCH_HEAD ``` -------------------------------- ### Certificate Workflow Overview Source: https://docs.larafast.com/multi-tenancy/custom-domains/ssl-certificates Illustrates the sequence of background jobs for SSL certificate provisioning, from domain addition to certificate activation. ```text Team adds domain ↓ DNS Verification Job ↓ (DNS Verified Event) Create Forge Site Job ↓ (Forge Site Created Event) Create Certificate Job ↓ Certificate Active ✅ ``` -------------------------------- ### Install Laravel Cashier Paddle Package Source: https://docs.larafast.com/features/payments/paddle Install the Paddle payment gateway package using Composer. This command adds the necessary dependencies for Paddle integration. ```bash composer require laravel/cashier-paddle ``` -------------------------------- ### Create Larafast Installation Alias Source: https://docs.larafast.com/ Add this alias to your `.bashrc` or `.zshrc` file to simplify the Larafast installation command. After adding the alias, source your shell configuration file. ```bash alias "larafast"="curl -s -O https://larafast.com/install && bash install" ``` ```bash source ~/.bashrc ``` ```bash source ~/.zshrc ``` ```bash larafast [YOUR_PROJECT_NAME] ``` -------------------------------- ### Configure Admin Panel Provider Source: https://docs.larafast.com/multi-tenancy/configuration/panel-setup Sets up the admin panel with specific configurations like ID, path, login, and color scheme. It discovers resources, pages, and widgets for the admin panel and sets authentication middleware. No tenant configuration is applied. ```php id('admin') ->path('admin') ->login() ->colors([ 'primary' => Color::Amber, ]) ->discoverResources(in: app_path('Filament/Admin/Resources'), for: 'App\\Filament\\Admin\\Resources') ->discoverPages(in: app_path('Filament/Admin/Pages'), for: 'App\\Filament\\Admin\\Pages') ->discoverWidgets(in: app_path('Filament/Admin/Widgets'), for: 'App\\Filament\\Admin\\Widgets') ->middleware([ // ... standard middleware ]) ->authMiddleware([ Authenticate::class, ]); // No tenant configuration } } ``` -------------------------------- ### Update a Team Source: https://docs.larafast.com/multi-tenancy/database/teams-table Example of updating an existing team's name and description. ```php $team = Team::find(1); $team->update([ 'name' => 'New Team Name', 'description' => 'Updated description', ]); ``` -------------------------------- ### Choose Database Source: https://docs.larafast.com/larafast-installer This interactive prompt allows you to select the database you want to use for your project. ```bash ┌ Choose your Database ────────────────────────────────────────┐ │ ○ SQLite │ │ › ● MySQL │ │ ○ PostgreSQL │ │ ○ SQL Server │ └──────────────────────────────────────────────────────────────┘ ``` -------------------------------- ### Manual and Automated Backups Source: https://docs.larafast.com/multi-tenancy/settings/environment-management Implement backup strategies for your .env file, either manually or automated during deployments. ```bash # Manual backup cp .env .env.backup # Automated backup in deployment cp .env .env.$(date +%Y%m%d_%H%M%S) ``` -------------------------------- ### Activate Certificate Manually Source: https://docs.larafast.com/multi-tenancy/custom-domains/ssl-certificates Manually activate an installed but inactive SSL certificate using the Forge service. ```php # Run the check command php artisan app:check-custom-domain-setup # Or manually via tinker $forge = app("App\Services\ForgeService"::class); $forge->activateCertificate($siteId, $certificateId); ``` -------------------------------- ### Check Certificate Status Source: https://docs.larafast.com/multi-tenancy/custom-domains/ssl-certificates Retrieve domain details and check the status of SSL certificate installation and activation. ```php // Get domain with certificate details $domain = Domain::where('domain', 'app.clientdomain.com')->first(); // Check status if ($domain->ssl_active && $domain->ssl_installed) { echo "✅ Certificate active and working"; } elseif ($domain->ssl_installed && !$domain->ssl_active) { echo "⏳ Certificate installed, activating..."; } elseif (!$domain->ssl_installed) { echo "⏳ Certificate being provisioned..."; } ``` -------------------------------- ### Remove Starter Kit Git Configs Source: https://docs.larafast.com/intro-tall Remove the starter kit's Git configuration and initialize a fresh Git repository if needed. ```bash rm -rf .git ``` -------------------------------- ### Create Larafast Alias Source: https://docs.larafast.com/larafast-installer Add this alias to your `.bashrc` or `.zshrc` file to simplify the Larafast installation command. ```bash alias "larafast"="curl -s -O https://larafast.com/install && bash install" ``` -------------------------------- ### Delete a Team Source: https://docs.larafast.com/multi-tenancy/database/teams-table Example of deleting a team. This action cascades to delete associated records in the 'team_user' table. ```php $team = Team::find(1); $team->delete(); // Cascades to team_user records ``` -------------------------------- ### Run Database Migrations Source: https://docs.larafast.com/features/payments/paddle Run your application's database migrations to create the necessary tables for storing customer, subscription, and transaction data. This includes tables for customers, subscriptions, subscription items, and Paddle transactions. ```bash php artisan migrate ``` -------------------------------- ### Choose Boilerplate Source: https://docs.larafast.com/larafast-installer This is an interactive prompt that allows you to select the desired Larafast boilerplate. Ensure you have git access to install. ```bash ┌ Choose your Boilerplate ───────────────────────────────────────────────┐ │ › ● Larafast TALL Stack (Tailwind CSS, Alpine.js, Laravel, Livewire) │ │ ○ Larafast VILT Stack (Vue.js, Inertia.js, Laravel, Tailwind CSS) │ │ ○ Larafast Directory Boilerplate │ │ ○ Larafast API Boilerplate │ ○ Larafast Multi-Tenancy │ └────────────────────────────────────────────────────────────────────────┘ ``` -------------------------------- ### Invitation Link Example Source: https://docs.larafast.com/multi-tenancy/invitations/accepting-invitations Invitation links are unique, secure, and expire after 7 days. They can only be used once and are accessible on any device. ```text https://yourapp.com/invitations/accept/abc123... ``` -------------------------------- ### Seed Products with ProductSeeder Source: https://docs.larafast.com/fast-projects/directories/features/products Use this command to seed initial product data into the database. Modify the `database/seeders/ProductSeeder.php` file to customize product details. ```bash php artisan db:seed --class=ProductSeeder ``` -------------------------------- ### Configure Changelog Route Source: https://docs.larafast.com/features/changelog Defines the GET route for the changelog index page, linking it to the ChangelogController and naming the route. ```php Route::get('changelog', [ChangelogController::class, 'index'])->name('changelog.index'); ``` -------------------------------- ### Bring Application Online Source: https://docs.larafast.com/multi-tenancy/settings/general-settings If your application is in maintenance mode, use this command to bring it back online. ```bash php artisan up ``` -------------------------------- ### Clone Larafast TALL Stack Project Source: https://docs.larafast.com/intro-tall Use these commands to clone the Larafast TALL Stack repository and install Composer dependencies. ```bash git clone git@github.com:karakhanyans-tools/larafast-tall.git [YOUR_PROJECT_NAME] cd [YOUR_PROJECT_NAME] composer install ``` -------------------------------- ### Define Pricing Plans in PHP Source: https://docs.larafast.com/multi-tenancy/pricing/overview Configure your pricing tiers, including name, price, features, and subscription interval, in the `lang/en/prices.php` configuration file. Ensure the 'slug' matches the Stripe Price ID for seamless integration. ```php 'stripe' => [ [ 'name' => 'Free', 'slug' => 'free', 'description' => 'Perfect for small teams getting started', 'price' => 0, 'interval' => 'month', 'features' => [ 'Up to 3 projects', 'Basic features', '5 team members', 'Email support', ], ], [ 'name' => 'Starter', 'slug' => 'starter', // Must match Stripe Price ID 'description' => 'For growing teams', 'price' => '29.99', 'interval' => 'month', 'features' => [ 'Everything in Free', 'Unlimited projects', 'Unlimited team members', 'Advanced features', 'Priority support', ], 'bestseller' => true, // Shows "Most Popular" badge ], [ 'name' => 'Pro', 'slug' => 'pro', // Must match Stripe Price ID 'description' => 'For large organizations', 'price' => '99.99', 'interval' => 'month', 'features' => [ 'Everything in Starter', 'Custom integrations', 'Dedicated account manager', 'SLA guarantee', 'Phone support', ], ], ], ``` -------------------------------- ### Automatic Assignment Example Source: https://docs.larafast.com/multi-tenancy/database/tenant-scoped-tables Illustrates how the global scope automatically assigns the `team_id` to new records when they are created, simplifying the creation process. ```php // You don't need to manually set team_id $project = Project::create([ 'name' => 'New Project', 'description' => 'Description', // team_id is set automatically ]); ``` -------------------------------- ### Reload Supervisor Configuration Source: https://docs.larafast.com/multi-tenancy/custom-domains/setup-guide After creating or modifying Supervisor configuration files, run these commands to apply the changes and start the worker processes. ```bash sudo supervisorctl reread sudo supervisorctl update sudo supervisorctl start laravel-worker:* ``` -------------------------------- ### Set Up Stripe API Keys Source: https://docs.larafast.com/features/payments/stripe Configure your Stripe API keys in the .env file. Replace 'publishable_key' and 'secret_key' with your actual Stripe keys. ```dotenv STRIPE_KEY=publishable_key STRIPE_SECRET=secret_key ``` -------------------------------- ### Create Stripe Products and Prices Source: https://docs.larafast.com/features/payments/stripe Use this artisan command to create products and prices in Stripe based on configurations in products.json and prices.json. Rerun the command to sync changes. ```bash php artisan stripe:create-products-and-prices ``` -------------------------------- ### Configure Database Connection (.env) Source: https://docs.larafast.com/features/database Update these variables in your .env file to connect to your desired database. Ensure the database server is running and accessible. ```env DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=laravelstarterkit DB_USERNAME=root DB_PASSWORD= ``` -------------------------------- ### Create Lessons Table Migration Source: https://docs.larafast.com/multi-tenancy/examples/learning-platform Generates the migration file for the 'lessons' table. This table holds individual lesson details within a course, including content, type, video URL, duration, and order. ```php php artisan make:migration create_lessons_table ``` ```php Schema::create('lessons', function (Blueprint $table) { $table->id(); $table->foreignId('team_id')->constrained()->cascadeOnDelete(); $table->foreignId('course_id')->constrained()->cascadeOnDelete(); $table->string('title'); $table->text('content'); // Markdown or HTML content $table->enum('type', ['video', 'text', 'quiz', 'assignment']); $table->string('video_url')->nullable(); $table->unsignedInteger('duration_minutes')->default(0); $table->unsignedInteger('order')->default(0); $table->boolean('is_free_preview')->default(false); $table->timestamps(); $table->index(['team_id', 'course_id', 'order']); }); ``` -------------------------------- ### EnvManager in Filament Save Method Source: https://docs.larafast.com/multi-tenancy/settings/environment-management Example of using EnvManager within a Filament page's save method to update multiple settings. ```php public function save(): void { $data = $this->form->getState(); $envManager = new EnvManager; $envManager->setMany([ 'APP_NAME' => $data['app_name'], 'APP_DEBUG' => $data['debug_enabled'], 'MAIL_FROM_ADDRESS' => $data['mail_from_address'], ]); Notification::make() ->title('Settings saved successfully') ->success() ->send(); } ``` -------------------------------- ### Publish LemonSqueezy Migrations Source: https://docs.larafast.com/features/payments/lemonsqueezy Run this command to publish the necessary migration files for LemonSqueezy. ```bash php artisan vendor:publish --tag="lemon-squeezy-migrations" ``` -------------------------------- ### Implement canAccessPanel() Method Source: https://docs.larafast.com/multi-tenancy/configuration/user-model Controls access to specific Filament panels. For example, it can restrict access to an 'admin' panel based on user roles. ```php public function canAccessPanel(Panel $panel): bool { if ($panel->getId() === 'admin') { return $this->hasRole('admin'); } return true; } ``` -------------------------------- ### Copy Environment File Source: https://docs.larafast.com/tutorials/zero-downtime-deployment-with-laravel-forge Copies the .env file from the user's home directory to the current release directory. Exits with an error if the .env file is not found. ```bash printf '\nℹ️ Copy ./.env file\n' ENV_FILE=~/"$DOMAIN"/.env if [ -f "$ENV_FILE" ]; then cp $ENV_FILE ./.env else printf '\nError: .env file is missing at %s.' "$ENV_FILE" && exit 1 fi ```