2026-01-15 01:13:44 +00:00
|
|
|
<?php
|
|
|
|
|
|
refactor: settings redesign, Spanish translations, language system, strict_types
Settings pages:
- Redesign layout to match Sendkit (max-w-4xl, space-y-12, Separator sections)
- Merge Members page into Workspace settings with Table, invite Dialog, ConfirmDeleteModal
- Add workspace logo upload/delete routes and controller methods
- Translate all hardcoded strings in Workspace.vue modals
Language system:
- Drop languages table, replace language_id FK with locale string column on users
- Create config/languages.php for available languages and default locale
- Add Spanish (es) translations (13 files)
- Simplify HandleInertiaRequests, ProfileController, RegisteredUserController
Code quality:
- Add declare(strict_types=1) to all PHP files
- Fix MastodonPublisher using wrong attribute (filename -> original_filename)
- Fix HasMediaTest for new has_photo/photo_url accessors
- Fix PublishToSocialPlatformTest type error revealed by strict_types
- Remove orphaned Language model from AppServiceProvider morph map
- Update User TypeScript interface (has_photo, photo_url, locale)
- Eager load media relation on workspaces to prevent N+1
- Add 8 new tests for workspace logo upload/delete
- Update workspace settings test to assert members/invitations props
All 710 tests passing.
2026-03-30 03:20:43 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2026-01-15 01:13:44 +00:00
|
|
|
namespace App\Providers;
|
|
|
|
|
|
2026-04-16 13:03:14 +00:00
|
|
|
use App\Ai\PlatformRules\BlueskyRules;
|
|
|
|
|
use App\Ai\PlatformRules\FacebookRules;
|
|
|
|
|
use App\Ai\PlatformRules\InstagramRules;
|
|
|
|
|
use App\Ai\PlatformRules\LinkedInRules;
|
|
|
|
|
use App\Ai\PlatformRules\MastodonRules;
|
|
|
|
|
use App\Ai\PlatformRules\PinterestRules;
|
|
|
|
|
use App\Ai\PlatformRules\Registry;
|
|
|
|
|
use App\Ai\PlatformRules\ThreadsRules;
|
|
|
|
|
use App\Ai\PlatformRules\TikTokRules;
|
|
|
|
|
use App\Ai\PlatformRules\XRules;
|
|
|
|
|
use App\Ai\PlatformRules\YouTubeRules;
|
2026-04-16 12:50:36 +00:00
|
|
|
use App\Ai\Providers\ExtendedGeminiProvider;
|
2026-04-16 13:03:14 +00:00
|
|
|
use App\Enums\SocialAccount\Platform;
|
2026-01-17 02:46:30 +00:00
|
|
|
use App\Listeners\StripeEventListener;
|
2026-05-03 21:38:17 +00:00
|
|
|
use App\Models\AccessToken;
|
2026-04-15 01:22:04 +00:00
|
|
|
use App\Models\Account;
|
2026-04-16 00:06:06 +00:00
|
|
|
use App\Models\AiUsageLog;
|
2026-04-15 01:22:04 +00:00
|
|
|
use App\Models\Invite;
|
2026-01-18 19:46:27 +00:00
|
|
|
use App\Models\Media;
|
feat: notification system with SendNotification job, dialog UI, tests
Backend:
- Create notifications table (user_id, workspace_id, type, channel,
title, body, data JSON, read_at, archived_at)
- Create Notification model with Type enum (post_failed,
account_disconnected, invite_received, member_joined, member_removed)
and Channel enum (email, in_app, both)
- Create SendNotification job: isolated from publish flow, handles
saving in-app notification and sending email independently
- NotificationController: index (excludes archived, scoped to workspace),
markAsRead, markAllAsRead, archiveAll
- Integrate with PublishToSocialPlatform (post failed/partial)
- Integrate with VerifyWorkspaceConnections (batch disconnection)
- Integrate with SocialAccount::markAsDisconnected (single disconnection)
- All use SendNotification::dispatch() instead of direct Mail::to()
Frontend:
- NotificationBell component in sidebar footer with unread badge
- Dialog with notification list, mark as read, mark all read, archive all
- Click navigates to relevant page (post edit, accounts)
- i18n for notifications UI (en, es, pt-BR)
Tests:
- 8 tests for NotificationController (auth, CRUD, workspace scoping)
- 4 tests for SendNotification job (channels, email, data storage)
All 745 tests passing.
2026-03-30 19:47:03 +00:00
|
|
|
use App\Models\Notification;
|
refactor: notification preferences, header slots, calendar layout, UI polish
Notification preferences:
- Create notification_preferences table (post_published, post_failed,
account_disconnected booleans per user)
- NotificationPreferenceController with firstOrCreate on first visit
- SendNotification job respects email preferences before sending
- Settings page with toggle switches, i18n in 3 languages
- 8 new tests for preferences (controller + wantsEmailFor + job integration)
Post published notification:
- PostPublished mail + maizzle template
- Notify owner on successful publish via SendNotification job
- PostPublished type added to notification enum
Header & Layout:
- Rename AppSidebarHeader to AppHeader with left/center/right slots
- showSidebarTrigger prop to hide sidebar toggle
- Calendar: controls in header (left: nav, center: date, right: tabs + new post)
- Fixed header with scrollable content (flex h-screen pattern)
- fullWidth pages use overflow-y-auto (fixes month view scroll)
UI improvements:
- Action buttons moved to header-right: posts, hashtags, labels
- Settings breadcrumbs: "Settings > Profile" pattern
- Calendar: remove duplicate New Post button from day view
- Remove size="sm" from Schedule/Publish buttons
- Remove bg-background from header (inherits from SidebarInset)
- Add Cancel button to labels and hashtags create/edit dialogs
- Add common.cancel i18n key
- Clean up orphaned Calendar breadcrumbs
- Fix SocialAccountsGrid buttons to use shadcn Button ghost
All 753 tests passing.
2026-03-30 21:18:17 +00:00
|
|
|
use App\Models\NotificationPreference;
|
2026-04-14 20:50:41 +00:00
|
|
|
use App\Models\Plan;
|
2026-01-18 19:46:27 +00:00
|
|
|
use App\Models\Post;
|
2026-04-15 23:08:16 +00:00
|
|
|
use App\Models\PostComment;
|
2026-01-18 19:46:27 +00:00
|
|
|
use App\Models\PostPlatform;
|
|
|
|
|
use App\Models\SocialAccount;
|
2026-01-17 17:44:37 +00:00
|
|
|
use App\Models\Subscription;
|
|
|
|
|
use App\Models\SubscriptionItem;
|
2026-01-18 19:46:27 +00:00
|
|
|
use App\Models\User;
|
|
|
|
|
use App\Models\Workspace;
|
2026-05-03 19:52:28 +00:00
|
|
|
use App\Models\WorkspaceInvite;
|
2026-01-18 19:46:27 +00:00
|
|
|
use App\Models\WorkspaceLabel;
|
2026-05-03 18:23:30 +00:00
|
|
|
use App\Models\WorkspaceSignature;
|
2026-05-03 16:44:13 +00:00
|
|
|
use App\Services\PostTemplate\Registry as PostTemplateRegistry;
|
2026-01-17 02:46:30 +00:00
|
|
|
use App\Socialite\InstagramProvider;
|
2026-01-15 17:24:39 +00:00
|
|
|
use App\Socialite\LinkedInPageExtendSocialite;
|
2026-01-15 01:13:44 +00:00
|
|
|
use Carbon\CarbonImmutable;
|
2026-01-18 19:46:27 +00:00
|
|
|
use Illuminate\Auth\Notifications\ResetPassword;
|
|
|
|
|
use Illuminate\Auth\Notifications\VerifyEmail;
|
2026-03-29 23:14:23 +00:00
|
|
|
use Illuminate\Cache\RateLimiting\Limit;
|
2026-04-16 12:50:36 +00:00
|
|
|
use Illuminate\Contracts\Events\Dispatcher;
|
feat: implement MCP server with tools, Post API tests, auth middleware
- Create TryPostServer MCP server with 17 tools:
Post (List, Get, Create, Delete), Hashtag (List, Create, Update, Delete),
Label (List, Create, Update, Delete), Workspace (Get),
ApiKey (List, Create, Delete)
- Create AuthenticateMcpToken middleware (logs in workspace owner)
- Register mcp.auth middleware alias in bootstrap/app.php
- Create routes/ai.php with mcp.trypost.test subdomain
- Add PostApiTest with 6 tests (list, show, create, delete, isolation)
- Fix PostApiTest assertions for pagination/resource wrapping
- 704 tests passing, frontend build passing
2026-03-29 23:30:36 +00:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2026-01-18 19:46:27 +00:00
|
|
|
use Illuminate\Database\Eloquent\Relations\Relation;
|
2026-03-29 23:14:23 +00:00
|
|
|
use Illuminate\Http\Request;
|
2026-01-18 19:46:27 +00:00
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
2026-01-15 01:13:44 +00:00
|
|
|
use Illuminate\Support\Facades\Date;
|
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
use Illuminate\Support\Facades\Event;
|
2026-03-29 23:14:23 +00:00
|
|
|
use Illuminate\Support\Facades\RateLimiter;
|
2026-01-15 01:13:44 +00:00
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
|
use Illuminate\Validation\Rules\Password;
|
2026-05-03 21:38:17 +00:00
|
|
|
use Inertia\Inertia;
|
2026-04-16 12:50:36 +00:00
|
|
|
use Laravel\Ai\Ai;
|
|
|
|
|
use Laravel\Ai\Gateway\Gemini\GeminiGateway;
|
2026-01-17 17:44:37 +00:00
|
|
|
use Laravel\Cashier\Cashier;
|
2026-01-17 02:46:30 +00:00
|
|
|
use Laravel\Cashier\Events\WebhookReceived;
|
2026-01-18 19:46:27 +00:00
|
|
|
use Laravel\Nightwatch\Facades\Nightwatch;
|
|
|
|
|
use Laravel\Nightwatch\Records\CacheEvent;
|
2026-05-03 21:38:17 +00:00
|
|
|
use Laravel\Passport\Passport;
|
2026-04-14 21:44:47 +00:00
|
|
|
use Laravel\Pennant\Feature;
|
2026-01-17 02:46:30 +00:00
|
|
|
use Laravel\Socialite\Facades\Socialite;
|
2026-03-31 00:18:07 +00:00
|
|
|
use Laravel\Socialite\Two\GoogleProvider;
|
|
|
|
|
use PostHog\PostHog;
|
2026-01-17 02:46:30 +00:00
|
|
|
use SocialiteProviders\Facebook\FacebookExtendSocialite;
|
2026-01-15 01:13:44 +00:00
|
|
|
use SocialiteProviders\LinkedIn\LinkedInExtendSocialite;
|
|
|
|
|
use SocialiteProviders\Manager\SocialiteWasCalled;
|
2026-01-18 16:10:01 +00:00
|
|
|
use SocialiteProviders\Pinterest\PinterestExtendSocialite;
|
2026-01-15 01:13:44 +00:00
|
|
|
use SocialiteProviders\TikTok\TikTokExtendSocialite;
|
|
|
|
|
|
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Register any application services.
|
|
|
|
|
*/
|
|
|
|
|
public function register(): void
|
|
|
|
|
{
|
2026-05-03 16:44:13 +00:00
|
|
|
$this->app->singleton(PostTemplateRegistry::class);
|
|
|
|
|
|
feat: implement MCP server with tools, Post API tests, auth middleware
- Create TryPostServer MCP server with 17 tools:
Post (List, Get, Create, Delete), Hashtag (List, Create, Update, Delete),
Label (List, Create, Update, Delete), Workspace (Get),
ApiKey (List, Create, Delete)
- Create AuthenticateMcpToken middleware (logs in workspace owner)
- Register mcp.auth middleware alias in bootstrap/app.php
- Create routes/ai.php with mcp.trypost.test subdomain
- Add PostApiTest with 6 tests (list, show, create, delete, isolation)
- Fix PostApiTest assertions for pagination/resource wrapping
- 704 tests passing, frontend build passing
2026-03-29 23:30:36 +00:00
|
|
|
if ($this->app->environment('local') && class_exists(\Laravel\Telescope\TelescopeServiceProvider::class)) {
|
|
|
|
|
$this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
|
|
|
|
|
$this->app->register(TelescopeServiceProvider::class);
|
|
|
|
|
}
|
2026-01-15 01:13:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Bootstrap any application services.
|
|
|
|
|
*/
|
|
|
|
|
public function boot(): void
|
|
|
|
|
{
|
|
|
|
|
$this->configureDefaults();
|
2026-01-18 19:46:27 +00:00
|
|
|
$this->configureMorphMap();
|
2026-04-16 12:50:36 +00:00
|
|
|
$this->configureAi();
|
2026-04-16 13:03:14 +00:00
|
|
|
$this->configurePlatformRules();
|
2026-03-31 00:18:07 +00:00
|
|
|
$this->configurePostHog();
|
2026-03-29 23:14:23 +00:00
|
|
|
$this->configureRateLimiting();
|
2026-01-15 01:13:44 +00:00
|
|
|
$this->configureSocialite();
|
2026-01-17 02:46:30 +00:00
|
|
|
$this->configureStripeWebhooks();
|
2026-01-17 17:44:37 +00:00
|
|
|
|
2026-04-15 01:22:04 +00:00
|
|
|
Cashier::useCustomerModel(Account::class);
|
2026-01-17 17:44:37 +00:00
|
|
|
Cashier::useSubscriptionModel(Subscription::class);
|
|
|
|
|
Cashier::useSubscriptionItemModel(SubscriptionItem::class);
|
2026-04-14 21:44:47 +00:00
|
|
|
|
2026-04-15 01:22:04 +00:00
|
|
|
Feature::resolveScopeUsing(fn () => auth()->user()?->account);
|
2026-04-14 21:44:47 +00:00
|
|
|
Feature::useMorphMap();
|
|
|
|
|
Feature::discover();
|
2026-05-03 21:38:17 +00:00
|
|
|
|
|
|
|
|
$this->configurePassport();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function configurePassport(): void
|
|
|
|
|
{
|
|
|
|
|
Passport::useTokenModel(AccessToken::class);
|
|
|
|
|
|
|
|
|
|
Passport::tokensCan([
|
|
|
|
|
'mcp:use' => 'Use MCP server',
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
Passport::authorizationView(fn ($parameters) => Inertia::render('oauth/Authorize', $parameters)
|
|
|
|
|
);
|
2026-01-17 02:46:30 +00:00
|
|
|
}
|
|
|
|
|
|
2026-04-16 12:50:36 +00:00
|
|
|
protected function configureAi(): void
|
|
|
|
|
{
|
feat: add GenerateImage, GenerateVideo, GenerateAudio SDK tools
Each tool implements Laravel\Ai\Contracts\Tool with description(),
handle(Request), and schema(JsonSchema). They share a common pattern:
- Constructor receives Workspace, optional Post, userId, and an optional
AttachmentCollector (resolves from container if not injected).
- handle() does the work (Image::of(), Audio::of(), or calls our custom
VideoGenerationService for Veo), persists media + usage log, pushes
the full attachment shape into the collector, and returns a short
text summary to the LLM.
- schema() exposes typed parameters with enum constraints and doc
strings so the LLM selects valid inputs.
Also fix the Ai::extend closure signature — MultipleInstanceManager
passes (app, config) not just (config) to custom creators.
2026-04-16 12:56:25 +00:00
|
|
|
Ai::extend('gemini', function ($app, array $config) {
|
2026-04-16 12:50:36 +00:00
|
|
|
return new ExtendedGeminiProvider(
|
feat: add GenerateImage, GenerateVideo, GenerateAudio SDK tools
Each tool implements Laravel\Ai\Contracts\Tool with description(),
handle(Request), and schema(JsonSchema). They share a common pattern:
- Constructor receives Workspace, optional Post, userId, and an optional
AttachmentCollector (resolves from container if not injected).
- handle() does the work (Image::of(), Audio::of(), or calls our custom
VideoGenerationService for Veo), persists media + usage log, pushes
the full attachment shape into the collector, and returns a short
text summary to the LLM.
- schema() exposes typed parameters with enum constraints and doc
strings so the LLM selects valid inputs.
Also fix the Ai::extend closure signature — MultipleInstanceManager
passes (app, config) not just (config) to custom creators.
2026-04-16 12:56:25 +00:00
|
|
|
new GeminiGateway($app['events']),
|
2026-04-16 12:50:36 +00:00
|
|
|
$config,
|
feat: add GenerateImage, GenerateVideo, GenerateAudio SDK tools
Each tool implements Laravel\Ai\Contracts\Tool with description(),
handle(Request), and schema(JsonSchema). They share a common pattern:
- Constructor receives Workspace, optional Post, userId, and an optional
AttachmentCollector (resolves from container if not injected).
- handle() does the work (Image::of(), Audio::of(), or calls our custom
VideoGenerationService for Veo), persists media + usage log, pushes
the full attachment shape into the collector, and returns a short
text summary to the LLM.
- schema() exposes typed parameters with enum constraints and doc
strings so the LLM selects valid inputs.
Also fix the Ai::extend closure signature — MultipleInstanceManager
passes (app, config) not just (config) to custom creators.
2026-04-16 12:56:25 +00:00
|
|
|
$app->make(Dispatcher::class),
|
2026-04-16 12:50:36 +00:00
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-16 13:03:14 +00:00
|
|
|
protected function configurePlatformRules(): void
|
|
|
|
|
{
|
|
|
|
|
$map = [
|
|
|
|
|
Platform::Instagram->value => InstagramRules::class,
|
|
|
|
|
Platform::InstagramFacebook->value => InstagramRules::class,
|
|
|
|
|
Platform::Facebook->value => FacebookRules::class,
|
|
|
|
|
Platform::X->value => XRules::class,
|
|
|
|
|
Platform::TikTok->value => TikTokRules::class,
|
|
|
|
|
Platform::YouTube->value => YouTubeRules::class,
|
|
|
|
|
Platform::LinkedIn->value => LinkedInRules::class,
|
|
|
|
|
Platform::LinkedInPage->value => LinkedInRules::class,
|
|
|
|
|
Platform::Threads->value => ThreadsRules::class,
|
|
|
|
|
Platform::Pinterest->value => PinterestRules::class,
|
|
|
|
|
Platform::Bluesky->value => BlueskyRules::class,
|
|
|
|
|
Platform::Mastodon->value => MastodonRules::class,
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
foreach ($map as $value => $class) {
|
|
|
|
|
Registry::register(
|
|
|
|
|
Platform::from($value),
|
|
|
|
|
$class,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-18 19:46:27 +00:00
|
|
|
protected function configureMorphMap(): void
|
|
|
|
|
{
|
|
|
|
|
Relation::enforceMorphMap([
|
2026-05-03 21:38:17 +00:00
|
|
|
'accessToken' => AccessToken::class,
|
2026-04-15 01:22:04 +00:00
|
|
|
'account' => Account::class,
|
2026-04-16 00:06:06 +00:00
|
|
|
'aiUsageLog' => AiUsageLog::class,
|
2026-04-15 01:22:04 +00:00
|
|
|
'invite' => Invite::class,
|
2026-01-18 19:46:27 +00:00
|
|
|
'media' => Media::class,
|
feat: notification system with SendNotification job, dialog UI, tests
Backend:
- Create notifications table (user_id, workspace_id, type, channel,
title, body, data JSON, read_at, archived_at)
- Create Notification model with Type enum (post_failed,
account_disconnected, invite_received, member_joined, member_removed)
and Channel enum (email, in_app, both)
- Create SendNotification job: isolated from publish flow, handles
saving in-app notification and sending email independently
- NotificationController: index (excludes archived, scoped to workspace),
markAsRead, markAllAsRead, archiveAll
- Integrate with PublishToSocialPlatform (post failed/partial)
- Integrate with VerifyWorkspaceConnections (batch disconnection)
- Integrate with SocialAccount::markAsDisconnected (single disconnection)
- All use SendNotification::dispatch() instead of direct Mail::to()
Frontend:
- NotificationBell component in sidebar footer with unread badge
- Dialog with notification list, mark as read, mark all read, archive all
- Click navigates to relevant page (post edit, accounts)
- i18n for notifications UI (en, es, pt-BR)
Tests:
- 8 tests for NotificationController (auth, CRUD, workspace scoping)
- 4 tests for SendNotification job (channels, email, data storage)
All 745 tests passing.
2026-03-30 19:47:03 +00:00
|
|
|
'notification' => Notification::class,
|
refactor: notification preferences, header slots, calendar layout, UI polish
Notification preferences:
- Create notification_preferences table (post_published, post_failed,
account_disconnected booleans per user)
- NotificationPreferenceController with firstOrCreate on first visit
- SendNotification job respects email preferences before sending
- Settings page with toggle switches, i18n in 3 languages
- 8 new tests for preferences (controller + wantsEmailFor + job integration)
Post published notification:
- PostPublished mail + maizzle template
- Notify owner on successful publish via SendNotification job
- PostPublished type added to notification enum
Header & Layout:
- Rename AppSidebarHeader to AppHeader with left/center/right slots
- showSidebarTrigger prop to hide sidebar toggle
- Calendar: controls in header (left: nav, center: date, right: tabs + new post)
- Fixed header with scrollable content (flex h-screen pattern)
- fullWidth pages use overflow-y-auto (fixes month view scroll)
UI improvements:
- Action buttons moved to header-right: posts, hashtags, labels
- Settings breadcrumbs: "Settings > Profile" pattern
- Calendar: remove duplicate New Post button from day view
- Remove size="sm" from Schedule/Publish buttons
- Remove bg-background from header (inherits from SidebarInset)
- Add Cancel button to labels and hashtags create/edit dialogs
- Add common.cancel i18n key
- Clean up orphaned Calendar breadcrumbs
- Fix SocialAccountsGrid buttons to use shadcn Button ghost
All 753 tests passing.
2026-03-30 21:18:17 +00:00
|
|
|
'notificationPreference' => NotificationPreference::class,
|
2026-05-03 19:52:28 +00:00
|
|
|
'plan' => Plan::class,
|
2026-01-18 19:46:27 +00:00
|
|
|
'post' => Post::class,
|
2026-04-15 23:08:16 +00:00
|
|
|
'postComment' => PostComment::class,
|
2026-01-18 19:46:27 +00:00
|
|
|
'postPlatform' => PostPlatform::class,
|
|
|
|
|
'socialAccount' => SocialAccount::class,
|
|
|
|
|
'subscription' => Subscription::class,
|
|
|
|
|
'subscriptionItem' => SubscriptionItem::class,
|
|
|
|
|
'user' => User::class,
|
|
|
|
|
'workspace' => Workspace::class,
|
2026-05-03 19:52:28 +00:00
|
|
|
'workspaceInvite' => WorkspaceInvite::class,
|
2026-01-18 19:46:27 +00:00
|
|
|
'workspaceLabel' => WorkspaceLabel::class,
|
2026-05-03 19:52:28 +00:00
|
|
|
'workspaceSignature' => WorkspaceSignature::class,
|
2026-01-18 19:46:27 +00:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-31 00:18:07 +00:00
|
|
|
protected function configurePostHog(): void
|
|
|
|
|
{
|
|
|
|
|
$apiKey = config('services.posthog.api_key');
|
|
|
|
|
|
|
|
|
|
if ($apiKey) {
|
|
|
|
|
PostHog::init($apiKey, [
|
|
|
|
|
'host' => config('services.posthog.host'),
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-29 23:14:23 +00:00
|
|
|
protected function configureRateLimiting(): void
|
|
|
|
|
{
|
|
|
|
|
RateLimiter::for('api', function (Request $request) {
|
|
|
|
|
if ($this->app->environment('local')) {
|
|
|
|
|
return Limit::none();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Limit::perMinute(60)->by($request->workspace?->id ?: $request->ip());
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-17 02:46:30 +00:00
|
|
|
protected function configureStripeWebhooks(): void
|
|
|
|
|
{
|
|
|
|
|
Event::listen(WebhookReceived::class, StripeEventListener::class);
|
2026-01-15 01:13:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function configureSocialite(): void
|
|
|
|
|
{
|
2026-03-31 00:18:07 +00:00
|
|
|
// Google Auth (login/signup) - separate from YouTube OAuth
|
|
|
|
|
Socialite::extend('google-auth', function ($app) {
|
|
|
|
|
$config = $app['config']['services.google-auth'];
|
|
|
|
|
|
|
|
|
|
return Socialite::buildProvider(GoogleProvider::class, $config);
|
|
|
|
|
});
|
|
|
|
|
|
2026-01-17 02:46:30 +00:00
|
|
|
// Instagram Business Login
|
|
|
|
|
Socialite::extend('instagram', function ($app) {
|
|
|
|
|
$config = $app['config']['services.instagram'];
|
|
|
|
|
|
|
|
|
|
return Socialite::buildProvider(InstagramProvider::class, $config);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Event::listen(SocialiteWasCalled::class, FacebookExtendSocialite::class);
|
2026-01-15 01:13:44 +00:00
|
|
|
Event::listen(SocialiteWasCalled::class, LinkedInExtendSocialite::class);
|
|
|
|
|
Event::listen(SocialiteWasCalled::class, LinkedInPageExtendSocialite::class);
|
2026-01-18 16:10:01 +00:00
|
|
|
Event::listen(SocialiteWasCalled::class, PinterestExtendSocialite::class);
|
2026-01-15 01:13:44 +00:00
|
|
|
Event::listen(SocialiteWasCalled::class, TikTokExtendSocialite::class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function configureDefaults(): void
|
|
|
|
|
{
|
|
|
|
|
Date::use(CarbonImmutable::class);
|
|
|
|
|
|
2026-01-18 19:46:27 +00:00
|
|
|
// Disable wrapping of JSON resources
|
|
|
|
|
JsonResource::withoutWrapping();
|
feat: implement MCP server with tools, Post API tests, auth middleware
- Create TryPostServer MCP server with 17 tools:
Post (List, Get, Create, Delete), Hashtag (List, Create, Update, Delete),
Label (List, Create, Update, Delete), Workspace (Get),
ApiKey (List, Create, Delete)
- Create AuthenticateMcpToken middleware (logs in workspace owner)
- Register mcp.auth middleware alias in bootstrap/app.php
- Create routes/ai.php with mcp.trypost.test subdomain
- Add PostApiTest with 6 tests (list, show, create, delete, isolation)
- Fix PostApiTest assertions for pagination/resource wrapping
- 704 tests passing, frontend build passing
2026-03-29 23:30:36 +00:00
|
|
|
Model::shouldBeStrict(! $this->app->isProduction());
|
2026-01-18 19:46:27 +00:00
|
|
|
|
2026-05-03 22:45:38 +00:00
|
|
|
// DB::prohibitDestructiveCommands(
|
|
|
|
|
// app()->isProduction(),
|
|
|
|
|
// );
|
2026-01-15 01:13:44 +00:00
|
|
|
|
|
|
|
|
Password::defaults(fn (): ?Password => app()->isProduction()
|
|
|
|
|
? Password::min(12)
|
|
|
|
|
->mixedCase()
|
|
|
|
|
->letters()
|
|
|
|
|
->numbers()
|
|
|
|
|
->symbols()
|
|
|
|
|
->uncompromised()
|
|
|
|
|
: null
|
|
|
|
|
);
|
2026-01-18 19:46:27 +00:00
|
|
|
|
|
|
|
|
Nightwatch::rejectCacheEvents(function (CacheEvent $cacheEvent) {
|
|
|
|
|
return in_array($cacheEvent->key, [
|
|
|
|
|
'illuminate:foundation:down',
|
|
|
|
|
'illuminate:queue:restart',
|
|
|
|
|
'illuminate:schedule:interrupt',
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Custom email verification template
|
|
|
|
|
VerifyEmail::toMailUsing(function (User $user, string $url) {
|
|
|
|
|
return (new MailMessage)
|
|
|
|
|
->from(config('mail.from.address'), config('mail.from.name'))
|
2026-01-18 20:48:12 +00:00
|
|
|
->subject('Verify your email address')
|
2026-01-18 19:46:27 +00:00
|
|
|
->view('mail.email-verification', [
|
2026-01-18 20:48:12 +00:00
|
|
|
'title' => 'Verify your email address',
|
|
|
|
|
'previewText' => 'Please verify your email address.',
|
2026-01-18 19:46:27 +00:00
|
|
|
'user' => $user,
|
|
|
|
|
'url' => $url,
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Custom password reset template
|
|
|
|
|
ResetPassword::toMailUsing(function (User $user, string $token) {
|
|
|
|
|
$url = url(route('password.reset', [
|
|
|
|
|
'token' => $token,
|
|
|
|
|
'email' => $user->getEmailForPasswordReset(),
|
|
|
|
|
], false));
|
|
|
|
|
|
|
|
|
|
return (new MailMessage)
|
|
|
|
|
->from(config('mail.from.address'), config('mail.from.name'))
|
2026-01-18 20:48:12 +00:00
|
|
|
->subject('Reset your password')
|
2026-01-18 19:46:27 +00:00
|
|
|
->view('mail.password-reset', [
|
2026-01-18 20:48:12 +00:00
|
|
|
'title' => 'Reset your password',
|
|
|
|
|
'previewText' => 'Reset your password.',
|
2026-01-18 19:46:27 +00:00
|
|
|
'user' => $user,
|
|
|
|
|
'url' => $url,
|
|
|
|
|
]);
|
|
|
|
|
});
|
2026-01-15 01:13:44 +00:00
|
|
|
}
|
|
|
|
|
}
|