Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
refactor: restructure to Actions, subdomain routes (app/api), API tokens
Paulo Castellano8689e54e55da
diff --git a/app/Actions/ApiKey/CreateApiKey.php b/app/Actions/ApiKey/CreateApiKey.phpnew file mode 100644index 000000000..1594cf9dd--- /dev/null+++ b/app/Actions/ApiKey/CreateApiKey.php@@ -0,0 +1,34 @@+<?php++declare(strict_types=1);++namespace App\Actions\ApiKey;++use App\Models\ApiToken;+use App\Models\Workspace;+use Illuminate\Support\Facades\Hash;+use Illuminate\Support\Str;++class CreateApiKey+{+ /**+ * @param array{name: string, expires_at?: string|null} $data+ * @return array{token: ApiToken, plain_token: string}+ */+ public static function execute(Workspace $workspace, array $data): array+ {+ $plainToken = 'tp_'.Str::random(48);++ $apiToken = ApiToken::create([+ 'workspace_id' => $workspace->id,+ 'name' => data_get($data, 'name'),+ 'token_lookup' => substr($plainToken, 3, 16),+ 'token_hash' => Hash::make($plainToken),+ 'expires_at' => data_get($data, 'expires_at')+ ? now()->parse(data_get($data, 'expires_at'))->endOfDay()+ : null,+ ]);++ return ['token' => $apiToken, 'plain_token' => $plainToken];+ }+}diff --git a/app/Actions/ApiKey/DeleteApiKey.php b/app/Actions/ApiKey/DeleteApiKey.phpnew file mode 100644index 000000000..3957d656b--- /dev/null+++ b/app/Actions/ApiKey/DeleteApiKey.php@@ -0,0 +1,15 @@+<?php++declare(strict_types=1);++namespace App\Actions\ApiKey;++use App\Models\ApiToken;++class DeleteApiKey+{+ public static function execute(ApiToken $apiToken): void+ {+ $apiToken->delete();+ }+}diff --git a/app/Actions/Hashtag/CreateHashtag.php b/app/Actions/Hashtag/CreateHashtag.phpnew file mode 100644index 000000000..47e2eaa46--- /dev/null+++ b/app/Actions/Hashtag/CreateHashtag.php@@ -0,0 +1,19 @@+<?php++declare(strict_types=1);++namespace App\Actions\Hashtag;++use App\Models\Workspace;+use App\Models\WorkspaceHashtag;++class CreateHashtag+{+ public static function execute(Workspace $workspace, array $data): WorkspaceHashtag+ {+ return $workspace->hashtags()->create([+ 'name' => data_get($data, 'name'),+ 'hashtags' => data_get($data, 'hashtags'),+ ]);+ }+}diff --git a/app/Actions/Hashtag/DeleteHashtag.php b/app/Actions/Hashtag/DeleteHashtag.phpnew file mode 100644index 000000000..82119e6be--- /dev/null+++ b/app/Actions/Hashtag/DeleteHashtag.php@@ -0,0 +1,15 @@+<?php++declare(strict_types=1);++namespace App\Actions\Hashtag;++use App\Models\WorkspaceHashtag;++class DeleteHashtag+{+ public static function execute(WorkspaceHashtag $hashtag): void+ {+ $hashtag->delete();+ }+}diff --git a/app/Actions/Hashtag/UpdateHashtag.php b/app/Actions/Hashtag/UpdateHashtag.phpnew file mode 100644index 000000000..ec9f98fb1--- /dev/null+++ b/app/Actions/Hashtag/UpdateHashtag.php@@ -0,0 +1,20 @@+<?php++declare(strict_types=1);++namespace App\Actions\Hashtag;++use App\Models\WorkspaceHashtag;++class UpdateHashtag+{+ public static function execute(WorkspaceHashtag $hashtag, array $data): WorkspaceHashtag+ {+ $hashtag->update([+ 'name' => data_get($data, 'name'),+ 'hashtags' => data_get($data, 'hashtags'),+ ]);++ return $hashtag;+ }+}diff --git a/app/Actions/Invite/CreateInvite.php b/app/Actions/Invite/CreateInvite.phpnew file mode 100644index 000000000..465e17e73--- /dev/null+++ b/app/Actions/Invite/CreateInvite.php@@ -0,0 +1,26 @@+<?php++declare(strict_types=1);++namespace App\Actions\Invite;++use App\Enums\UserWorkspace\Role as WorkspaceRole;+use App\Mail\WorkspaceInvite as WorkspaceInviteMail;+use App\Models\Workspace;+use App\Models\WorkspaceInvite;+use Illuminate\Support\Facades\Mail;++class CreateInvite+{+ public static function execute(Workspace $workspace, array $data): WorkspaceInvite+ {+ $invite = $workspace->invites()->create([+ 'email' => data_get($data, 'email'),+ 'role' => data_get($data, 'role', WorkspaceRole::Member),+ ]);++ Mail::to($invite->email)->send(new WorkspaceInviteMail($invite));++ return $invite;+ }+}diff --git a/app/Actions/Invite/DeleteInvite.php b/app/Actions/Invite/DeleteInvite.phpnew file mode 100644index 000000000..1170f4ad5--- /dev/null+++ b/app/Actions/Invite/DeleteInvite.php@@ -0,0 +1,15 @@+<?php++declare(strict_types=1);++namespace App\Actions\Invite;++use App\Models\WorkspaceInvite;++class DeleteInvite+{+ public static function execute(WorkspaceInvite $invite): void+ {+ $invite->delete();+ }+}diff --git a/app/Actions/Invite/RemoveMember.php b/app/Actions/Invite/RemoveMember.phpnew file mode 100644index 000000000..0e978ec8e--- /dev/null+++ b/app/Actions/Invite/RemoveMember.php@@ -0,0 +1,15 @@+<?php++declare(strict_types=1);++namespace App\Actions\Invite;++use App\Models\Workspace;++class RemoveMember+{+ public static function execute(Workspace $workspace, string $userId): void+ {+ $workspace->members()->detach($userId);+ }+}diff --git a/app/Actions/Label/CreateLabel.php b/app/Actions/Label/CreateLabel.phpnew file mode 100644index 000000000..7ab1d95ab--- /dev/null+++ b/app/Actions/Label/CreateLabel.php@@ -0,0 +1,19 @@+<?php++declare(strict_types=1);++namespace App\Actions\Label;++use App\Models\Workspace;+use App\Models\WorkspaceLabel;++class CreateLabel+{+ public static function execute(Workspace $workspace, array $data): WorkspaceLabel+ {+ return $workspace->labels()->create([+ 'name' => data_get($data, 'name'),+ 'color' => data_get($data, 'color'),+ ]);+ }+}diff --git a/app/Actions/Label/DeleteLabel.php b/app/Actions/Label/DeleteLabel.phpnew file mode 100644index 000000000..6e58fc222--- /dev/null+++ b/app/Actions/Label/DeleteLabel.php@@ -0,0 +1,15 @@+<?php++declare(strict_types=1);++namespace App\Actions\Label;++use App\Models\WorkspaceLabel;++class DeleteLabel+{+ public static function execute(WorkspaceLabel $label): void+ {+ $label->delete();+ }+}diff --git a/app/Actions/Label/UpdateLabel.php b/app/Actions/Label/UpdateLabel.phpnew file mode 100644index 000000000..bfc0cb867--- /dev/null+++ b/app/Actions/Label/UpdateLabel.php@@ -0,0 +1,20 @@+<?php++declare(strict_types=1);++namespace App\Actions\Label;++use App\Models\WorkspaceLabel;++class UpdateLabel+{+ public static function execute(WorkspaceLabel $label, array $data): WorkspaceLabel+ {+ $label->update([+ 'name' => data_get($data, 'name'),+ 'color' => data_get($data, 'color'),+ ]);++ return $label;+ }+}diff --git a/app/Actions/Post/CreatePost.php b/app/Actions/Post/CreatePost.phpnew file mode 100644index 000000000..7e719cb67--- /dev/null+++ b/app/Actions/Post/CreatePost.php@@ -0,0 +1,45 @@+<?php++declare(strict_types=1);++namespace App\Actions\Post;++use App\Enums\Post\Status as PostStatus;+use App\Enums\PostPlatform\ContentType;+use App\Models\Post;+use App\Models\User;+use App\Models\Workspace;+use Carbon\Carbon;++class CreatePost+{+ public static function execute(Workspace $workspace, User $user, array $data): Post+ {+ $date = data_get($data, 'date') ?: Carbon::now($workspace->timezone)->format('Y-m-d');+ $scheduledAt = Carbon::parse($date, $workspace->timezone)+ ->setTime(9, 0)+ ->utc();++ $post = $workspace->posts()->create([+ 'user_id' => $user->id,+ 'status' => PostStatus::Draft,+ 'synced' => true,+ 'scheduled_at' => $scheduledAt,+ ]);++ $socialAccounts = $workspace->socialAccounts;++ foreach ($socialAccounts as $account) {+ $post->postPlatforms()->create([+ 'social_account_id' => $account->id,+ 'platform' => $account->platform->value,+ 'content' => '',+ 'content_type' => ContentType::defaultFor($account->platform),+ 'status' => 'pending',+ 'enabled' => true,+ ]);+ }++ return $post;+ }+}diff --git a/app/Actions/Post/DeletePost.php b/app/Actions/Post/DeletePost.phpnew file mode 100644index 000000000..071933c97--- /dev/null+++ b/app/Actions/Post/DeletePost.php@@ -0,0 +1,15 @@+<?php++declare(strict_types=1);++namespace App\Actions\Post;++use App\Models\Post;++class DeletePost+{+ public static function execute(Post $post): void+ {+ $post->delete();+ }+}diff --git a/app/Actions/Post/UpdatePost.php b/app/Actions/Post/UpdatePost.phpnew file mode 100644index 000000000..8658a78c0--- /dev/null+++ b/app/Actions/Post/UpdatePost.php@@ -0,0 +1,76 @@+<?php++declare(strict_types=1);++namespace App\Actions\Post;++use App\Enums\Post\Status as PostStatus;+use App\Jobs\PublishPost;+use App\Models\Post;+use App\Models\Workspace;+use Carbon\Carbon;++class UpdatePost+{+ /**+ * @return array{post: Post, action: string|null}+ */+ public static function execute(Workspace $workspace, Post $post, array $data): array+ {+ if ($post->status === PostStatus::Published) {+ return ['post' => $post, 'action' => 'already_published'];+ }++ $scheduledAt = $post->scheduled_at;+ if (data_get($data, 'scheduled_at')) {+ $scheduledAt = Carbon::parse(data_get($data, 'scheduled_at'), $workspace->timezone)->utc();+ }++ $status = data_get($data, 'status', $post->status);++ $post->update([+ 'status' => $status === 'publishing' ? PostStatus::Publishing : $status,+ 'synced' => data_get($data, 'synced', $post->synced),+ 'scheduled_at' => $scheduledAt,+ ]);++ if (array_key_exists('label_ids', $data)) {+ $post->labels()->sync(data_get($data, 'label_ids', []));+ }++ $post->postPlatforms()->update(['enabled' => false]);++ foreach (data_get($data, 'platforms', []) as $platformData) {+ $updateData = [+ 'enabled' => true,+ 'content' => data_get($platformData, 'content'),+ ];++ if (data_get($platformData, 'content_type') !== null) {+ $updateData['content_type'] = data_get($platformData, 'content_type');+ }++ if (isset($platformData['meta'])) {+ $postPlatform = $post->postPlatforms()->where('id', data_get($platformData, 'id'))->first();+ $updateData['meta'] = array_merge($postPlatform->meta ?? [], $platformData['meta']);+ }++ $post->postPlatforms()+ ->where('id', data_get($platformData, 'id'))+ ->update($updateData);+ }++ if ($status === 'publishing') {+ $post->update(['scheduled_at' => now()]);+ PublishPost::dispatch($post);++ return ['post' => $post, 'action' => 'publishing'];+ }++ if ($status === 'scheduled') {+ return ['post' => $post, 'action' => 'scheduled'];+ }++ return ['post' => $post, 'action' => null];+ }+}diff --git a/app/Actions/Workspace/CreateWorkspace.php b/app/Actions/Workspace/CreateWorkspace.phpnew file mode 100644index 000000000..37260a1b6--- /dev/null+++ b/app/Actions/Workspace/CreateWorkspace.php@@ -0,0 +1,29 @@+<?php++declare(strict_types=1);++namespace App\Actions\Workspace;++use App\Models\User;+use App\Models\Workspace;++class CreateWorkspace+{+ public static function execute(User $user, array $data): Workspace+ {+ $workspace = Workspace::create([+ 'user_id' => $user->id,+ ...$data,+ 'timezone' => config('app.timezone', 'UTC'),+ ]);++ $workspace->members()->attach($user->id, ['role' => 'owner']);+ $user->switchWorkspace($workspace);++ if ($user->hasActiveSubscription()) {+ $user->incrementWorkspaceQuantity();+ }++ return $workspace;+ }+}diff --git a/app/Actions/Workspace/DeleteWorkspace.php b/app/Actions/Workspace/DeleteWorkspace.phpnew file mode 100644index 000000000..f737fceeb--- /dev/null+++ b/app/Actions/Workspace/DeleteWorkspace.php@@ -0,0 +1,24 @@+<?php++declare(strict_types=1);++namespace App\Actions\Workspace;++use App\Models\User;+use App\Models\Workspace;++class DeleteWorkspace+{+ public static function execute(User $user, Workspace $workspace): void+ {+ if ($user->current_workspace_id === $workspace->id) {+ $user->update(['current_workspace_id' => null]);+ }++ $workspace->delete();++ if ($user->hasActiveSubscription()) {+ $user->decrementWorkspaceQuantity();+ }+ }+}diff --git a/app/Concerns/PasswordValidationRules.php b/app/Concerns/PasswordValidationRules.phpindex 9b45ef093..e8583028f 100644--- a/app/Concerns/PasswordValidationRules.php+++ b/app/Concerns/PasswordValidationRules.php@@ -2,6 +2,7 @@namespace App\Concerns;+use Illuminate\Contracts\Validation\Rule;use Illuminate\Validation\Rules\Password;trait PasswordValidationRules@@ -9,7 +10,7 @@ trait PasswordValidationRules/*** Get the validation rules used to validate passwords.*- * @return array<int, \Illuminate\Contracts\Validation\Rule|array<mixed>|string>+ * @return array<int, Rule|array<mixed>|string>*/protected function passwordRules(): array{@@ -19,7 +20,7 @@ trait PasswordValidationRules/*** Get the validation rules used to validate the current password.*- * @return array<int, \Illuminate\Contracts\Validation\Rule|array<mixed>|string>+ * @return array<int, Rule|array<mixed>|string>*/protected function currentPasswordRules(): array{diff --git a/app/Helpers/upload.php b/app/Helpers/upload.phpindex 1f4759914..72b5c986b 100644--- a/app/Helpers/upload.php+++ b/app/Helpers/upload.php@@ -49,7 +49,7 @@ if (! function_exists('uploadFromUrl')) {Storage::put($filename, $response->body(), 'public');return $filename;- } catch (\Exception $e) {+ } catch (Exception $e) {Log::warning('uploadFromUrl: Exception', ['url' => $url,'error' => $e->getMessage(),diff --git a/app/Http/Controllers/Api/ApiKeyController.php b/app/Http/Controllers/Api/ApiKeyController.phpnew file mode 100644index 000000000..83d5bb680--- /dev/null+++ b/app/Http/Controllers/Api/ApiKeyController.php@@ -0,0 +1,46 @@+<?php++declare(strict_types=1);++namespace App\Http\Controllers\Api;++use App\Actions\ApiKey\CreateApiKey;+use App\Actions\ApiKey\DeleteApiKey;+use App\Http\Requests\Api\ApiKey\StoreApiKeyRequest;+use App\Http\Resources\Api\ApiKeyResource;+use App\Models\ApiToken;+use Illuminate\Http\JsonResponse;+use Illuminate\Http\Request;+use Illuminate\Http\Resources\Json\AnonymousResourceCollection;+use Symfony\Component\HttpFoundation\Response;++class ApiKeyController extends Controller+{+ public function index(Request $request): AnonymousResourceCollection+ {+ $apiKeys = $request->workspace->apiTokens()->latest()->get();++ return ApiKeyResource::collection($apiKeys);+ }++ public function store(StoreApiKeyRequest $request): JsonResponse+ {+ $result = CreateApiKey::execute($request->workspace, $request->validated());++ return response()->json([+ 'token' => new ApiKeyResource(data_get($result, 'token')),+ 'plain_token' => data_get($result, 'plain_token'),+ ], Response::HTTP_CREATED);+ }++ public function destroy(Request $request, ApiToken $apiToken): JsonResponse+ {+ if ($apiToken->workspace_id !== $request->workspace->id) {+ abort(Response::HTTP_NOT_FOUND);+ }++ DeleteApiKey::execute($apiToken);++ return response()->json(null, Response::HTTP_NO_CONTENT);+ }+}diff --git a/app/Http/Controllers/Api/Controller.php b/app/Http/Controllers/Api/Controller.phpnew file mode 100644index 000000000..2fda368d0--- /dev/null+++ b/app/Http/Controllers/Api/Controller.php@@ -0,0 +1,12 @@+<?php++declare(strict_types=1);++namespace App\Http\Controllers\Api;++use App\Http\Controllers\Controller as BaseController;++abstract class Controller extends BaseController+{+ //+}diff --git a/app/Http/Controllers/Api/HashtagController.php b/app/Http/Controllers/Api/HashtagController.phpnew file mode 100644index 000000000..c7f3f43e0--- /dev/null+++ b/app/Http/Controllers/Api/HashtagController.php@@ -0,0 +1,58 @@+<?php++declare(strict_types=1);++namespace App\Http\Controllers\Api;++use App\Actions\Hashtag\CreateHashtag;+use App\Actions\Hashtag\DeleteHashtag;+use App\Actions\Hashtag\UpdateHashtag;+use App\Http\Requests\Api\Hashtag\StoreHashtagRequest;+use App\Http\Requests\Api\Hashtag\UpdateHashtagRequest;+use App\Http\Resources\Api\HashtagResource;+use App\Models\WorkspaceHashtag;+use Illuminate\Http\JsonResponse;+use Illuminate\Http\Request;+use Illuminate\Http\Resources\Json\AnonymousResourceCollection;+use Symfony\Component\HttpFoundation\Response;++class HashtagController extends Controller+{+ public function index(Request $request): AnonymousResourceCollection+ {+ $hashtags = $request->workspace->hashtags()->latest()->get();++ return HashtagResource::collection($hashtags);+ }++ public function store(StoreHashtagRequest $request): JsonResponse+ {+ $hashtag = CreateHashtag::execute($request->workspace, $request->validated());++ return (new HashtagResource($hashtag))+ ->response()+ ->setStatusCode(Response::HTTP_CREATED);+ }++ public function update(UpdateHashtagRequest $request, WorkspaceHashtag $hashtag): HashtagResource+ {+ if ($hashtag->workspace_id !== $request->workspace->id) {+ abort(Response::HTTP_NOT_FOUND);+ }++ $hashtag = UpdateHashtag::execute($hashtag, $request->validated());++ return new HashtagResource($hashtag);+ }++ public function destroy(Request $request, WorkspaceHashtag $hashtag): JsonResponse+ {+ if ($hashtag->workspace_id !== $request->workspace->id) {+ abort(Response::HTTP_NOT_FOUND);+ }++ DeleteHashtag::execute($hashtag);++ return response()->json(null, Response::HTTP_NO_CONTENT);+ }+}diff --git a/app/Http/Controllers/Api/LabelController.php b/app/Http/Controllers/Api/LabelController.phpnew file mode 100644index 000000000..a453ace03--- /dev/null+++ b/app/Http/Controllers/Api/LabelController.php@@ -0,0 +1,58 @@+<?php++declare(strict_types=1);++namespace App\Http\Controllers\Api;++use App\Actions\Label\CreateLabel;+use App\Actions\Label\DeleteLabel;+use App\Actions\Label\UpdateLabel;+use App\Http\Requests\Api\Label\StoreLabelRequest;+use App\Http\Requests\Api\Label\UpdateLabelRequest;+use App\Http\Resources\Api\LabelResource;+use App\Models\WorkspaceLabel;+use Illuminate\Http\JsonResponse;+use Illuminate\Http\Request;+use Illuminate\Http\Resources\Json\AnonymousResourceCollection;+use Symfony\Component\HttpFoundation\Response;++class LabelController extends Controller+{+ public function index(Request $request): AnonymousResourceCollection+ {+ $labels = $request->workspace->labels()->latest()->get();++ return LabelResource::collection($labels);+ }++ public function store(StoreLabelRequest $request): JsonResponse+ {+ $label = CreateLabel::execute($request->workspace, $request->validated());++ return (new LabelResource($label))+ ->response()+ ->setStatusCode(Response::HTTP_CREATED);+ }++ public function update(UpdateLabelRequest $request, WorkspaceLabel $label): LabelResource+ {+ if ($label->workspace_id !== $request->workspace->id) {+ abort(Response::HTTP_NOT_FOUND);+ }++ $label = UpdateLabel::execute($label, $request->validated());++ return new LabelResource($label);+ }++ public function destroy(Request $request, WorkspaceLabel $label): JsonResponse+ {+ if ($label->workspace_id !== $request->workspace->id) {+ abort(Response::HTTP_NOT_FOUND);+ }++ DeleteLabel::execute($label);++ return response()->json(null, Response::HTTP_NO_CONTENT);+ }+}diff --git a/app/Http/Controllers/Api/PostController.php b/app/Http/Controllers/Api/PostController.phpnew file mode 100644index 000000000..55ce2fbd1--- /dev/null+++ b/app/Http/Controllers/Api/PostController.php@@ -0,0 +1,83 @@+<?php++declare(strict_types=1);++namespace App\Http\Controllers\Api;++use App\Actions\Post\CreatePost;+use App\Actions\Post\DeletePost;+use App\Actions\Post\UpdatePost;+use App\Http\Resources\Api\PostResource;+use App\Models\Post;+use Illuminate\Http\JsonResponse;+use Illuminate\Http\Request;+use Illuminate\Http\Resources\Json\AnonymousResourceCollection;+use Symfony\Component\HttpFoundation\Response;++class PostController extends Controller+{+ public function index(Request $request): AnonymousResourceCollection+ {+ $posts = $request->workspace->posts()+ ->with(['postPlatforms.socialAccount', 'user', 'labels'])+ ->latest('scheduled_at')+ ->paginate(15);++ return PostResource::collection($posts);+ }++ public function show(Request $request, Post $post): PostResource+ {+ if ($post->workspace_id !== $request->workspace->id) {+ abort(Response::HTTP_NOT_FOUND);+ }++ $post->load(['postPlatforms.socialAccount', 'user', 'labels']);++ return new PostResource($post);+ }++ public function store(Request $request): JsonResponse+ {+ $post = CreatePost::execute(+ $request->workspace,+ $request->workspace->members()->first(),+ $request->all()+ );++ $post->load(['postPlatforms.socialAccount']);++ return (new PostResource($post))+ ->response()+ ->setStatusCode(Response::HTTP_CREATED);+ }++ public function update(Request $request, Post $post): PostResource|JsonResponse+ {+ if ($post->workspace_id !== $request->workspace->id) {+ abort(Response::HTTP_NOT_FOUND);+ }++ $result = UpdatePost::execute($request->workspace, $post, $request->all());++ if (data_get($result, 'action') === 'already_published') {+ return response()->json(+ ['message' => 'Cannot edit a published post.'],+ Response::HTTP_UNPROCESSABLE_ENTITY+ );+ }++ return new PostResource(data_get($result, 'post'));+ }++ public function destroy(Request $request, Post $post): JsonResponse+ {+ if ($post->workspace_id !== $request->workspace->id) {+ abort(Response::HTTP_NOT_FOUND);+ }++ DeletePost::execute($post);++ return response()->json(null, Response::HTTP_NO_CONTENT);+ }+}diff --git a/app/Http/Controllers/Api/WorkspaceController.php b/app/Http/Controllers/Api/WorkspaceController.phpnew file mode 100644index 000000000..4bb7340ac--- /dev/null+++ b/app/Http/Controllers/Api/WorkspaceController.php@@ -0,0 +1,16 @@+<?php++declare(strict_types=1);++namespace App\Http\Controllers\Api;++use App\Http\Resources\Api\WorkspaceResource;+use Illuminate\Http\Request;++class WorkspaceController extends Controller+{+ public function show(Request $request): WorkspaceResource+ {+ return new WorkspaceResource($request->workspace);+ }+}diff --git a/app/Http/Controllers/App/ApiKeyController.php b/app/Http/Controllers/App/ApiKeyController.phpnew file mode 100644index 000000000..397b6d885--- /dev/null+++ b/app/Http/Controllers/App/ApiKeyController.php@@ -0,0 +1,78 @@+<?php++declare(strict_types=1);++namespace App\Http\Controllers\App;++use App\Actions\ApiKey\CreateApiKey;+use App\Actions\ApiKey\DeleteApiKey;+use App\Models\ApiToken;+use Illuminate\Http\RedirectResponse;+use Illuminate\Http\Request;+use Inertia\Inertia;+use Inertia\Response;++class ApiKeyController extends Controller+{+ public function index(Request $request): Response|RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('view', $workspace);++ return Inertia::render('settings/ApiKeys', [+ 'workspace' => $workspace,+ 'apiTokens' => $workspace->apiTokens()->latest()->get(),+ ]);+ }++ public function store(Request $request): RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('view', $workspace);++ $validated = $request->validate([+ 'name' => ['required', 'string', 'max:255'],+ 'expires_at' => ['nullable', 'date', 'after:today'],+ ]);++ $result = CreateApiKey::execute($workspace, $validated);++ session()->flash('flash.banner', __('settings.api_keys.flash.created'));+ session()->flash('flash.bannerStyle', 'success');+ session()->flash('flash.plainToken', data_get($result, 'plain_token'));++ return back();+ }++ public function destroy(Request $request, ApiToken $apiToken): RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('view', $workspace);++ if ($apiToken->workspace_id !== $workspace->id) {+ abort(404);+ }++ DeleteApiKey::execute($apiToken);++ session()->flash('flash.banner', __('settings.api_keys.flash.deleted'));+ session()->flash('flash.bannerStyle', 'success');++ return back();+ }+}diff --git a/app/Http/Controllers/App/BillingController.php b/app/Http/Controllers/App/BillingController.phpnew file mode 100644index 000000000..8a33f0a7e--- /dev/null+++ b/app/Http/Controllers/App/BillingController.php@@ -0,0 +1,128 @@+<?php++declare(strict_types=1);++namespace App\Http\Controllers\App;++use Illuminate\Http\RedirectResponse;+use Illuminate\Http\Request;+use Inertia\Inertia;+use Inertia\Response;+use Symfony\Component\HttpFoundation\Response as SymfonyResponse;++class BillingController extends Controller+{+ public function subscribe(Request $request): Response|RedirectResponse+ {+ $user = $request->user();++ if ($user->subscribed('default')) {+ return redirect()->route('app.billing.index');+ }++ return Inertia::render('billing/Subscribe', [+ 'trialDays' => config('cashier.trial_days'),+ ]);+ }++ public function index(Request $request): Response+ {+ $user = $request->user();+ $subscription = $user->subscription('default');++ return Inertia::render('billing/Index', [+ 'hasSubscription' => $user->subscribed('default'),+ 'onTrial' => $subscription?->onTrial() ?? false,+ 'trialEndsAt' => $subscription?->trial_ends_at?->toFormattedDateString(),+ 'subscription' => $subscription?->only([+ 'stripe_status',+ 'quantity',+ 'ends_at',+ ]),+ 'workspacesCount' => $user->ownedWorkspacesCount(),+ 'invoices' => $user->invoices()->map(fn ($invoice) => [+ 'id' => $invoice->id,+ 'date' => $invoice->date()->toFormattedDateString(),+ 'total' => $invoice->total(),+ 'status' => $invoice->status,+ 'invoice_pdf' => $invoice->invoice_pdf,+ ]),+ 'defaultPaymentMethod' => $user->defaultPaymentMethod()?->card?->only([+ 'brand',+ 'last4',+ 'exp_month',+ 'exp_year',+ ]),+ ]);+ }++ public function checkout(Request $request): SymfonyResponse+ {+ $user = $request->user();++ $subscription = $user->newSubscription('default', config('cashier.plans.monthly.price_id'))+ ->allowPromotionCodes()+ ->trialDays(config('cashier.trial_days'))+ ->quantity(1);++ $checkoutSession = $subscription->checkout([+ 'success_url' => route('app.billing.processing').'?status=success',+ 'cancel_url' => route('app.billing.processing').'?status=cancelled',+ ]);++ return Inertia::location($checkoutSession->url);+ }++ public function processing(Request $request): Response|RedirectResponse+ {+ $user = $request->user();+ $status = $request->query('status', 'processing');++ if ($user->subscribed('default')) {+ return redirect()->route('app.calendar');+ }++ if (! in_array($status, ['processing', 'success', 'cancelled'])) {+ $status = 'processing';+ }++ return Inertia::render('billing/Processing', [+ 'userId' => $user->id,+ 'status' => $status,+ ]);+ }++ public function portal(Request $request): RedirectResponse+ {+ return $request->user()->redirectToBillingPortal(+ route('app.billing.index')+ );+ }++ public function addWorkspace(Request $request): RedirectResponse+ {+ $user = $request->user();++ if (! $user->subscribed('default')) {+ return redirect()->route('app.billing.index')+ ->withErrors(['subscription' => 'You need an active subscription.']);+ }++ $user->incrementWorkspaceQuantity();++ return back()->with('success', 'Workspace added to subscription.');+ }++ public function removeWorkspace(Request $request): RedirectResponse+ {+ $user = $request->user();++ if (! $user->subscribed('default')) {+ return back();+ }++ $user->decrementWorkspaceQuantity();++ return back()->with('success', 'Workspace removed from subscription.');+ }+}diff --git a/app/Http/Controllers/App/Controller.php b/app/Http/Controllers/App/Controller.phpnew file mode 100644index 000000000..e5cc1701f--- /dev/null+++ b/app/Http/Controllers/App/Controller.php@@ -0,0 +1,12 @@+<?php++declare(strict_types=1);++namespace App\Http\Controllers\App;++use App\Http\Controllers\Controller as BaseController;++abstract class Controller extends BaseController+{+ //+}diff --git a/app/Http/Controllers/App/MediaController.php b/app/Http/Controllers/App/MediaController.phpnew file mode 100644index 000000000..398cbdb10--- /dev/null+++ b/app/Http/Controllers/App/MediaController.php@@ -0,0 +1,152 @@+<?php++declare(strict_types=1);++namespace App\Http\Controllers\App;++use App\Http\Requests\StoreChunkedMediaRequest;+use App\Http\Requests\StoreMediaRequest;+use App\Models\Media;+use Illuminate\Database\Eloquent\Model;+use Illuminate\Database\Eloquent\Relations\Relation;+use Illuminate\Http\JsonResponse;+use Illuminate\Http\Request;++class MediaController extends Controller+{+ public function store(StoreMediaRequest $request): JsonResponse+ {+ $model = $this->resolveModel($request->input('model'), $request->input('model_id'));+ $collection = $request->input('collection', 'default');++ $media = $model->addMedia(+ $request->file('media'),+ $collection+ );++ return response()->json([+ 'id' => $media->id,+ 'group_id' => $media->group_id,+ 'url' => $media->url,+ 'type' => $media->type->value,+ 'original_filename' => $media->original_filename,+ ]);+ }++ public function storeChunked(StoreChunkedMediaRequest $request): JsonResponse+ {+ $tempFile = $this->chunkTempPath($request->chunkIdentifier());++ $this->appendChunk($tempFile, $request->getContent(), $request->isFirstChunk());++ if (! $request->isLastChunk()) {+ return response()->json([+ 'done' => false,+ 'progress' => $request->progress(),+ ]);+ }++ $model = $this->resolveModel($request->input('model'), $request->input('model_id'));++ $media = $model->addMediaFromPath(+ $tempFile,+ $request->input('file_name'),+ $request->input('collection'),+ );++ @unlink($tempFile);++ return response()->json([+ 'done' => true,+ 'id' => $media->id,+ 'group_id' => $media->group_id,+ 'url' => $media->url,+ 'type' => $media->type->value,+ 'original_filename' => $media->original_filename,+ ]);+ }++ public function destroy(string $modelId, Media $media): JsonResponse+ {+ if ($media->mediable_id !== $modelId) {+ abort(403);+ }++ $media->delete();++ return response()->json(['success' => true]);+ }++ public function reorder(Request $request): JsonResponse+ {+ $request->validate([+ 'media' => 'required|array',+ 'media.*.id' => 'required|exists:medias,id',+ 'media.*.order' => 'required|integer|min:0',+ ]);++ foreach ($request->input('media') as $item) {+ Media::where('id', $item['id'])->update(['order' => $item['order']]);+ }++ return response()->json(['success' => true]);+ }++ public function duplicate(Media $media, Request $request): JsonResponse+ {+ $targets = $request->input('targets', []);+ $duplicates = [];++ foreach ($targets as $target) {+ $model = $this->resolveModel($target['model'], $target['model_id']);+ $collection = $target['collection'] ?? $media->collection;++ $duplicate = $model->media()->create([+ 'group_id' => $media->group_id,+ 'collection' => $collection,+ 'type' => $media->type,+ 'path' => $media->path,+ 'original_filename' => $media->original_filename,+ 'mime_type' => $media->mime_type,+ 'size' => $media->size,+ 'order' => $media->order,+ 'meta' => $media->meta,+ ]);++ $duplicates[] = [+ 'id' => $duplicate->id,+ 'group_id' => $duplicate->group_id,+ 'mediable_id' => $duplicate->mediable_id,+ 'mediable_type' => $duplicate->mediable_type,+ 'url' => $duplicate->url,+ 'type' => $duplicate->type->value,+ 'original_filename' => $duplicate->original_filename,+ ];+ }++ return response()->json($duplicates);+ }++ private function resolveModel(string $alias, string $id): Model+ {+ $modelClass = Relation::getMorphedModel($alias) ?? $alias;++ return $modelClass::findOrFail($id);+ }++ private function chunkTempPath(string $identifier): string+ {+ return storage_path("app/private/chunks/{$identifier}");+ }++ private function appendChunk(string $path, string $content, bool $isFirst): void+ {+ $directory = dirname($path);++ if (! is_dir($directory)) {+ mkdir($directory, 0755, true);+ }++ file_put_contents($path, $content, $isFirst ? 0 : FILE_APPEND);+ }+}diff --git a/app/Http/Controllers/App/OnboardingController.php b/app/Http/Controllers/App/OnboardingController.phpnew file mode 100644index 000000000..17fd7ad6c--- /dev/null+++ b/app/Http/Controllers/App/OnboardingController.php@@ -0,0 +1,110 @@+<?php++declare(strict_types=1);++namespace App\Http\Controllers\App;++use App\Enums\SocialAccount\Platform as SocialPlatform;+use App\Enums\User\Persona;+use App\Enums\User\Setup;+use Illuminate\Http\RedirectResponse;+use Illuminate\Http\Request;+use Illuminate\Validation\Rule;+use Inertia\Inertia;+use Inertia\Response;+use Symfony\Component\HttpFoundation\Response as SymfonyResponse;++class OnboardingController extends Controller+{+ public function step1(): Response+ {+ return Inertia::render('onboarding/Step1', [+ 'personas' => Persona::toSelectArray(),+ ]);+ }++ public function storeStep1(Request $request): RedirectResponse+ {+ $validated = $request->validate([+ 'persona' => ['required', Rule::enum(Persona::class)],+ ]);++ $request->user()->update([+ 'persona' => $validated['persona'],+ 'setup' => Setup::Connections,+ ]);++ return redirect()->route('app.onboarding.step2');+ }++ public function step2(Request $request): Response+ {+ $user = $request->user();+ $workspace = $user->currentWorkspace;++ $platforms = collect();++ if ($workspace) {+ $connectedAccounts = $workspace->socialAccounts;++ $platforms = collect(SocialPlatform::enabled())->map(fn ($platform) => [+ 'value' => $platform->value,+ 'label' => $platform->label(),+ 'color' => $platform->color(),+ 'connected' => $connectedAccounts->firstWhere('platform', $platform) !== null,+ 'account' => $connectedAccounts->firstWhere('platform', $platform),+ ])->values();+ }++ return Inertia::render('onboarding/Step2', [+ 'platforms' => $platforms,+ 'hasWorkspace' => $workspace !== null,+ ]);+ }++ public function storeStep2(Request $request): SymfonyResponse|RedirectResponse+ {+ $user = $request->user();++ if (config('trypost.self_hosted')) {+ $user->update([+ 'setup' => Setup::Completed,+ ]);++ session()->flash('flash.banner', __('auth.flash.welcome'));+ session()->flash('flash.bannerStyle', 'success');++ return redirect()->route('app.calendar');+ }++ $user->update([+ 'setup' => Setup::Subscription,+ ]);++ $subscription = $user->newSubscription('default', config('cashier.plans.monthly.price_id'))+ ->allowPromotionCodes()+ ->trialDays(config('cashier.trial_days'))+ ->quantity(1);++ $checkoutSession = $subscription->checkout([+ 'success_url' => route('app.onboarding.complete').'?session_id={CHECKOUT_SESSION_ID}',+ 'cancel_url' => route('app.onboarding.step2'),+ ]);++ return Inertia::location($checkoutSession->url);+ }++ public function complete(Request $request): RedirectResponse+ {+ $user = $request->user();++ $user->update([+ 'setup' => Setup::Completed,+ ]);++ session()->flash('flash.banner', __('auth.flash.welcome_trial'));+ session()->flash('flash.bannerStyle', 'success');++ return redirect()->route('app.calendar');+ }+}diff --git a/app/Http/Controllers/App/PostController.php b/app/Http/Controllers/App/PostController.phpnew file mode 100644index 000000000..cf2e8482a--- /dev/null+++ b/app/Http/Controllers/App/PostController.php@@ -0,0 +1,249 @@+<?php++declare(strict_types=1);++namespace App\Http\Controllers\App;++use App\Actions\Post\CreatePost;+use App\Actions\Post\DeletePost;+use App\Actions\Post\UpdatePost;+use App\Enums\SocialAccount\Platform;+use App\Http\Requests\UpdatePostRequest;+use App\Models\Post;+use App\Services\Social\PinterestPublisher;+use Carbon\Carbon;+use Illuminate\Http\RedirectResponse;+use Illuminate\Http\Request;+use Inertia\Inertia;+use Inertia\Response;++class PostController extends Controller+{+ public function index(Request $request, ?string $status = null): Response|RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('view', $workspace);++ $query = $workspace->posts()+ ->with(['postPlatforms' => fn ($query) => $query->where('enabled', true)->with('socialAccount'), 'user', 'labels']);++ if ($status) {+ $query = match ($status) {+ 'draft' => $query->draft(),+ 'scheduled' => $query->scheduled(),+ 'published' => $query->published(),+ default => $query,+ };+ }++ return Inertia::render('posts/Index', [+ 'workspace' => $workspace,+ 'posts' => Inertia::scroll(fn () => $query->latest('scheduled_at')->paginate(15)),+ 'currentStatus' => $status,+ ]);+ }++ public function calendar(Request $request): Response|RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('view', $workspace);++ $tz = $workspace->timezone;+ $view = $request->input('view', 'week');++ $currentDay = $request->input('day')+ ? Carbon::parse($request->input('day'), $tz)->startOfDay()+ : Carbon::now($tz)->startOfDay();++ $weekStart = $request->input('week')+ ? Carbon::parse($request->input('week'), $tz)->startOfWeek()+ : Carbon::now($tz)->startOfWeek();+ $weekEnd = $weekStart->copy()->endOfWeek();++ $monthDate = $request->input('month')+ ? Carbon::parse($request->input('month'), $tz)->startOfMonth()+ : Carbon::now($tz)->startOfMonth();+ $monthStart = $monthDate->copy()->startOfMonth()->startOfWeek();+ $monthEnd = $monthDate->copy()->endOfMonth()->endOfWeek();++ $rangeStart = match ($view) {+ 'day' => $currentDay,+ 'month' => $monthStart,+ default => $weekStart,+ };+ $rangeEnd = match ($view) {+ 'day' => $currentDay->copy()->endOfDay(),+ 'month' => $monthEnd,+ default => $weekEnd,+ };++ $posts = $workspace->posts()+ ->with(['postPlatforms' => fn ($query) => $query->where('enabled', true)->with('socialAccount')])+ ->whereBetween('scheduled_at', [$rangeStart->copy()->utc(), $rangeEnd->copy()->utc()])+ ->orderBy('scheduled_at')+ ->get()+ ->groupBy(fn ($post) => $post->scheduled_at?->setTimezone($tz)->format('Y-m-d'));++ return Inertia::render('posts/Calendar', [+ 'workspace' => $workspace,+ 'posts' => $posts,+ 'currentDay' => $currentDay->format('Y-m-d'),+ 'currentWeekStart' => $weekStart->format('Y-m-d'),+ 'currentMonth' => $monthDate->format('Y-m-d'),+ 'view' => $view,+ ]);+ }++ public function store(Request $request): RedirectResponse|\Symfony\Component\HttpFoundation\Response+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('view', $workspace);++ $socialAccounts = $workspace->socialAccounts;++ if ($socialAccounts->isEmpty()) {+ session()->flash('flash.banner', __('posts.flash.connect_first'));+ session()->flash('flash.bannerStyle', 'danger');++ return redirect()->route('app.accounts');+ }++ $post = CreatePost::execute($workspace, $request->user(), [+ 'date' => $request->input('date'),+ ]);++ return Inertia::location(route('app.posts.edit', $post));+ }++ public function edit(Request $request, Post $post): Response|RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('view', $workspace);++ if ($post->workspace_id !== $workspace->id) {+ abort(404);+ }++ $post->load(['postPlatforms.socialAccount', 'postPlatforms.media', 'labels']);+ $socialAccounts = $workspace->socialAccounts;+ $labels = $workspace->labels;+ $hashtags = $workspace->hashtags;++ $platformConfigs = $socialAccounts->mapWithKeys(fn ($account) => [+ $account->id => [+ 'maxContentLength' => $account->platform->maxContentLength(),+ 'maxImages' => $account->platform->maxImages(),+ 'allowedMediaTypes' => array_map(fn ($type) => $type->value, $account->platform->allowedMediaTypes()),+ 'supportsTextOnly' => $account->platform->supportsTextOnly(),+ ],+ ]);++ $pinterestBoards = [];+ $pinterestAccount = $socialAccounts->firstWhere('platform', Platform::Pinterest);+ if ($pinterestAccount) {+ try {+ $pinterestBoards = app(PinterestPublisher::class)->getBoards($pinterestAccount);+ } catch (\Exception $e) {+ // Silently fail - boards will be empty+ }+ }++ return Inertia::render('posts/Edit', [+ 'workspace' => $workspace,+ 'post' => $post,+ 'socialAccounts' => $socialAccounts,+ 'platformConfigs' => $platformConfigs,+ 'pinterestBoards' => $pinterestBoards,+ 'labels' => $labels,+ 'hashtags' => $hashtags,+ ]);+ }++ public function update(UpdatePostRequest $request, Post $post): RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('view', $workspace);++ if ($post->workspace_id !== $workspace->id) {+ abort(404);+ }++ $result = UpdatePost::execute($workspace, $post, $request->validated());++ $action = data_get($result, 'action');++ if ($action === 'already_published') {+ session()->flash('flash.banner', __('posts.flash.cannot_edit_published'));+ session()->flash('flash.bannerStyle', 'danger');++ return back();+ }++ if ($action === 'publishing') {+ session()->flash('flash.banner', __('posts.flash.publishing'));+ session()->flash('flash.bannerStyle', 'success');++ return redirect()->route('app.posts.edit', $post);+ }++ if ($action === 'scheduled') {+ session()->flash('flash.banner', __('posts.flash.scheduled'));+ session()->flash('flash.bannerStyle', 'success');++ return redirect()->route('app.posts.edit', $post);+ }++ return back();+ }++ public function destroy(Request $request, Post $post): RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('view', $workspace);++ if ($post->workspace_id !== $workspace->id) {+ abort(404);+ }++ DeletePost::execute($post);++ session()->flash('flash.banner', __('posts.flash.deleted'));+ session()->flash('flash.bannerStyle', 'success');++ if ($redirect = $request->input('redirect')) {+ return redirect()->route($redirect);+ }++ return back();+ }+}diff --git a/app/Http/Controllers/App/Settings/PasswordController.php b/app/Http/Controllers/App/Settings/PasswordController.phpnew file mode 100644index 000000000..afbb14a71--- /dev/null+++ b/app/Http/Controllers/App/Settings/PasswordController.php@@ -0,0 +1,38 @@+<?php++declare(strict_types=1);++namespace App\Http\Controllers\App\Settings;++use App\Http\Controllers\Controller;+use Illuminate\Http\RedirectResponse;+use Illuminate\Http\Request;+use Illuminate\Support\Facades\Hash;+use Illuminate\Validation\Rules\Password;+use Inertia\Inertia;+use Inertia\Response;++class PasswordController extends Controller+{+ public function edit(): Response+ {+ return Inertia::render('settings/Password');+ }++ public function update(Request $request): RedirectResponse+ {+ $validated = $request->validate([+ 'current_password' => ['required', 'current_password'],+ 'password' => ['required', Password::defaults(), 'confirmed'],+ ]);++ $request->user()->update([+ 'password' => Hash::make($validated['password']),+ ]);++ session()->flash('flash.banner', __('settings.flash.password_updated'));+ session()->flash('flash.bannerStyle', 'success');++ return back();+ }+}diff --git a/app/Http/Controllers/App/Settings/ProfileController.php b/app/Http/Controllers/App/Settings/ProfileController.phpnew file mode 100644index 000000000..838c6f264--- /dev/null+++ b/app/Http/Controllers/App/Settings/ProfileController.php@@ -0,0 +1,105 @@+<?php++declare(strict_types=1);++namespace App\Http\Controllers\App\Settings;++use App\Enums\UserWorkspace\Role;+use App\Http\Controllers\Controller;+use App\Http\Requests\Settings\ProfileDeleteRequest;+use App\Http\Requests\Settings\ProfileUpdateRequest;+use Illuminate\Contracts\Auth\MustVerifyEmail;+use Illuminate\Http\RedirectResponse;+use Illuminate\Http\Request;+use Illuminate\Support\Facades\Auth;+use Illuminate\Support\Facades\DB;+use Inertia\Inertia;+use Inertia\Response;++class ProfileController extends Controller+{+ public function edit(Request $request): Response+ {+ return Inertia::render('settings/Profile', [+ 'mustVerifyEmail' => $request->user() instanceof MustVerifyEmail,+ 'status' => $request->session()->get('status'),+ ]);+ }++ public function update(ProfileUpdateRequest $request): RedirectResponse+ {+ $request->user()->fill($request->validated());++ if ($request->user()->isDirty('email')) {+ $request->user()->email_verified_at = null;+ }++ $request->user()->save();++ session()->flash('flash.banner', __('settings.flash.profile_updated'));+ session()->flash('flash.bannerStyle', 'success');++ return to_route('app.profile.edit');+ }++ public function updateLanguage(Request $request): RedirectResponse+ {+ $request->validate([+ 'language_id' => ['required', 'exists:languages,id'],+ ]);++ $request->user()->update([+ 'language_id' => $request->language_id,+ ]);++ $request->user()->refresh();++ session()->flash('flash.banner', __('settings.flash.language_updated'));+ session()->flash('flash.bannerStyle', 'success');++ return back();+ }++ public function destroy(ProfileDeleteRequest $request): RedirectResponse+ {+ $user = $request->user();++ DB::transaction(function () use ($user) {+ if ($user->subscribed('default')) {+ $user->subscription('default')->cancelNow();+ }+ $user->subscriptions()->delete();+ $user->update(['current_workspace_id' => null]);++ $ownedWorkspaces = $user->workspaces()->wherePivot('role', Role::Owner->value)->get();++ foreach ($ownedWorkspaces as $workspace) {+ foreach ($workspace->members as $member) {+ if ($member->id !== $user->id && $member->current_workspace_id === $workspace->id) {+ $otherWorkspace = $member->workspaces()+ ->where('workspaces.id', '!=', $workspace->id)+ ->first();+ $member->update(['current_workspace_id' => $otherWorkspace?->id]);+ }+ }++ $workspace->posts()->delete();+ $workspace->socialAccounts()->delete();+ $workspace->hashtags()->delete();+ $workspace->labels()->delete();+ $workspace->invites()->delete();+ $workspace->members()->detach();+ $workspace->delete();+ }++ $user->workspaces()->detach();+ });++ Auth::logout();+ $user->delete();+ $request->session()->invalidate();+ $request->session()->regenerateToken();++ return redirect('/');+ }+}diff --git a/app/Http/Controllers/App/WorkspaceController.php b/app/Http/Controllers/App/WorkspaceController.phpnew file mode 100644index 000000000..d94d39dcd--- /dev/null+++ b/app/Http/Controllers/App/WorkspaceController.php@@ -0,0 +1,125 @@+<?php++declare(strict_types=1);++namespace App\Http\Controllers\App;++use App\Actions\Workspace\CreateWorkspace;+use App\Actions\Workspace\DeleteWorkspace;+use App\Http\Requests\StoreWorkspaceRequest;+use App\Http\Requests\UpdateWorkspaceRequest;+use App\Models\Workspace;+use Illuminate\Http\RedirectResponse;+use Illuminate\Http\Request;+use Inertia\Inertia;+use Inertia\Response;++class WorkspaceController extends Controller+{+ public function index(Request $request): Response+ {+ $user = $request->user();++ $workspaces = $user->workspaces()+ ->withCount(['socialAccounts', 'posts'])+ ->latest()+ ->get();++ return Inertia::render('workspaces/Index', [+ 'workspaces' => $workspaces,+ 'currentWorkspaceId' => $user->current_workspace_id,+ ]);+ }++ public function create(Request $request): Response|RedirectResponse+ {+ $user = $request->user();++ if ($user->ownedWorkspacesCount() > 0 && ! $user->hasActiveSubscription()) {+ return redirect()->route('app.billing.index')+ ->with('message', 'Subscribe to create more workspaces.');+ }++ return Inertia::render('workspaces/Create');+ }++ public function store(StoreWorkspaceRequest $request): RedirectResponse+ {+ $user = $request->user();++ if ($user->ownedWorkspacesCount() > 0 && ! $user->hasActiveSubscription()) {+ return redirect()->route('app.billing.index')+ ->with('message', 'Subscribe to create more workspaces.');+ }++ CreateWorkspace::execute($user, $request->validated());++ return redirect()->route('app.calendar')+ ->with('success', 'Workspace created successfully!');+ }++ public function switch(Request $request, Workspace $workspace): RedirectResponse+ {+ $user = $request->user();++ if (! $user->belongsToWorkspace($workspace)) {+ abort(403);+ }++ $user->switchWorkspace($workspace);++ return redirect()->route('app.calendar');+ }++ public function settings(Request $request): Response|RedirectResponse+ {+ $user = $request->user();+ $workspace = $user->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('update', $workspace);++ $timezones = collect(timezone_identifiers_list())+ ->mapWithKeys(fn ($tz) => [$tz => $tz])+ ->toArray();++ return Inertia::render('settings/Workspace', [+ 'workspace' => $workspace,+ 'timezones' => $timezones,+ ]);+ }++ public function updateSettings(UpdateWorkspaceRequest $request): RedirectResponse+ {+ $user = $request->user();+ $workspace = $user->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('update', $workspace);++ $workspace->update($request->validated());++ session()->flash('flash.banner', __('settings.flash.workspace_updated'));+ session()->flash('flash.bannerStyle', 'success');++ return redirect()->route('app.workspace.settings');+ }++ public function destroy(Request $request, Workspace $workspace): RedirectResponse+ {+ $this->authorize('delete', $workspace);++ $user = $request->user();++ DeleteWorkspace::execute($user, $workspace);++ return redirect()->route('app.workspaces.index')+ ->with('success', 'Workspace deleted successfully!');+ }+}diff --git a/app/Http/Controllers/App/WorkspaceHashtagController.php b/app/Http/Controllers/App/WorkspaceHashtagController.phpnew file mode 100644index 000000000..1da673f07--- /dev/null+++ b/app/Http/Controllers/App/WorkspaceHashtagController.php@@ -0,0 +1,105 @@+<?php++declare(strict_types=1);++namespace App\Http\Controllers\App;++use App\Actions\Hashtag\CreateHashtag;+use App\Actions\Hashtag\DeleteHashtag;+use App\Actions\Hashtag\UpdateHashtag;+use App\Models\WorkspaceHashtag;+use Illuminate\Http\RedirectResponse;+use Illuminate\Http\Request;+use Inertia\Inertia;+use Inertia\Response;++class WorkspaceHashtagController extends Controller+{+ public function index(Request $request): Response|RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('view', $workspace);++ return Inertia::render('hashtags/Index', [+ 'workspace' => $workspace,+ 'hashtags' => $workspace->hashtags()->latest()->get(),+ ]);+ }++ public function store(Request $request): RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('view', $workspace);++ $validated = $request->validate([+ 'name' => ['required', 'string', 'max:255'],+ 'hashtags' => ['required', 'string'],+ ]);++ CreateHashtag::execute($workspace, $validated);++ session()->flash('flash.banner', __('hashtags.flash.created'));+ session()->flash('flash.bannerStyle', 'success');++ return redirect()->route('app.hashtags.index');+ }++ public function update(Request $request, WorkspaceHashtag $hashtag): RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('view', $workspace);++ if ($hashtag->workspace_id !== $workspace->id) {+ abort(404);+ }++ $validated = $request->validate([+ 'name' => ['required', 'string', 'max:255'],+ 'hashtags' => ['required', 'string'],+ ]);++ UpdateHashtag::execute($hashtag, $validated);++ session()->flash('flash.banner', __('hashtags.flash.updated'));+ session()->flash('flash.bannerStyle', 'success');++ return redirect()->route('app.hashtags.index');+ }++ public function destroy(Request $request, WorkspaceHashtag $hashtag): RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('view', $workspace);++ if ($hashtag->workspace_id !== $workspace->id) {+ abort(404);+ }++ DeleteHashtag::execute($hashtag);++ session()->flash('flash.banner', __('hashtags.flash.deleted'));+ session()->flash('flash.bannerStyle', 'success');++ return redirect()->route('app.hashtags.index');+ }+}diff --git a/app/Http/Controllers/App/WorkspaceInviteController.php b/app/Http/Controllers/App/WorkspaceInviteController.phpnew file mode 100644index 000000000..36ca89053--- /dev/null+++ b/app/Http/Controllers/App/WorkspaceInviteController.php@@ -0,0 +1,136 @@+<?php++declare(strict_types=1);++namespace App\Http\Controllers\App;++use App\Actions\Invite\CreateInvite;+use App\Actions\Invite\DeleteInvite;+use App\Actions\Invite\RemoveMember;+use App\Enums\UserWorkspace\Role as WorkspaceRole;+use App\Http\Requests\StoreWorkspaceInviteRequest;+use App\Models\WorkspaceInvite;+use Illuminate\Http\RedirectResponse;+use Illuminate\Http\Request;+use Inertia\Inertia;+use Inertia\Response;++class WorkspaceInviteController extends Controller+{+ public function index(Request $request): Response|RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('manageTeam', $workspace);++ return Inertia::render('settings/Members', [+ 'workspace' => $workspace,+ 'invites' => $workspace->invites()+ ->latest()+ ->get(),+ 'members' => $workspace->members()+ ->where('user_id', '!=', $workspace->user_id)+ ->get()+ ->map(fn ($member) => [+ 'id' => $member->id,+ 'name' => $member->name,+ 'email' => $member->email,+ 'role' => $member->pivot->role,+ ]),+ 'owner' => [+ 'id' => $workspace->owner->id,+ 'name' => $workspace->owner->name,+ 'email' => $workspace->owner->email,+ 'role' => WorkspaceRole::Owner->value,+ ],+ 'roles' => collect(WorkspaceRole::cases())+ ->filter(fn ($role) => $role !== WorkspaceRole::Owner)+ ->map(fn ($role) => [+ 'value' => $role->value,+ 'label' => $role->label(),+ ])->values(),+ ]);+ }++ public function store(StoreWorkspaceInviteRequest $request): RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('manageTeam', $workspace);++ $existingInvite = $workspace->invites()+ ->where('email', $request->email)+ ->first();++ if ($existingInvite) {+ return back()->withErrors([+ 'email' => 'An invite already exists for this email.',+ ]);+ }++ if ($workspace->members()->where('email', $request->email)->exists()) {+ return back()->withErrors([+ 'email' => 'This user is already a member of the workspace.',+ ]);+ }++ CreateInvite::execute($workspace, $request->validated());++ session()->flash('flash.banner', __('settings.members.flash.invite_sent'));+ session()->flash('flash.bannerStyle', 'success');++ return back();+ }++ public function destroy(Request $request, WorkspaceInvite $invite): RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('manageTeam', $workspace);++ if ($invite->workspace_id !== $workspace->id) {+ abort(404);+ }++ DeleteInvite::execute($invite);++ session()->flash('flash.banner', __('settings.members.flash.invite_deleted'));+ session()->flash('flash.bannerStyle', 'success');++ return back();+ }++ public function removeMember(Request $request, string $userId): RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('manageTeam', $workspace);++ if ($workspace->user_id === $userId) {+ return back()->withErrors(['member' => 'Cannot remove the workspace owner.']);+ }++ RemoveMember::execute($workspace, $userId);++ session()->flash('flash.banner', __('settings.members.flash.member_removed'));+ session()->flash('flash.bannerStyle', 'success');++ return back();+ }+}diff --git a/app/Http/Controllers/App/WorkspaceLabelController.php b/app/Http/Controllers/App/WorkspaceLabelController.phpnew file mode 100644index 000000000..44cc0f71d--- /dev/null+++ b/app/Http/Controllers/App/WorkspaceLabelController.php@@ -0,0 +1,105 @@+<?php++declare(strict_types=1);++namespace App\Http\Controllers\App;++use App\Actions\Label\CreateLabel;+use App\Actions\Label\DeleteLabel;+use App\Actions\Label\UpdateLabel;+use App\Models\WorkspaceLabel;+use Illuminate\Http\RedirectResponse;+use Illuminate\Http\Request;+use Inertia\Inertia;+use Inertia\Response;++class WorkspaceLabelController extends Controller+{+ public function index(Request $request): Response|RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('view', $workspace);++ return Inertia::render('labels/Index', [+ 'workspace' => $workspace,+ 'labels' => $workspace->labels()->latest()->get(),+ ]);+ }++ public function store(Request $request): RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('view', $workspace);++ $validated = $request->validate([+ 'name' => ['required', 'string', 'max:255'],+ 'color' => ['required', 'string', 'max:7', 'regex:/^#[0-9A-Fa-f]{6}$/'],+ ]);++ CreateLabel::execute($workspace, $validated);++ session()->flash('flash.banner', __('labels.flash.created'));+ session()->flash('flash.bannerStyle', 'success');++ return redirect()->route('app.labels.index');+ }++ public function update(Request $request, WorkspaceLabel $label): RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('view', $workspace);++ if ($label->workspace_id !== $workspace->id) {+ abort(404);+ }++ $validated = $request->validate([+ 'name' => ['required', 'string', 'max:255'],+ 'color' => ['required', 'string', 'max:7', 'regex:/^#[0-9A-Fa-f]{6}$/'],+ ]);++ UpdateLabel::execute($label, $validated);++ session()->flash('flash.banner', __('labels.flash.updated'));+ session()->flash('flash.bannerStyle', 'success');++ return redirect()->route('app.labels.index');+ }++ public function destroy(Request $request, WorkspaceLabel $label): RedirectResponse+ {+ $workspace = $request->user()->currentWorkspace;++ if (! $workspace) {+ return redirect()->route('app.workspaces.create');+ }++ $this->authorize('view', $workspace);++ if ($label->workspace_id !== $workspace->id) {+ abort(404);+ }++ DeleteLabel::execute($label);++ session()->flash('flash.banner', __('labels.flash.deleted'));+ session()->flash('flash.bannerStyle', 'success');++ return redirect()->route('app.labels.index');+ }+}diff --git a/app/Http/Controllers/Auth/AcceptInviteController.php b/app/Http/Controllers/Auth/AcceptInviteController.phpindex 4ae3ebf5d..cc960fe46 100644--- a/app/Http/Controllers/Auth/AcceptInviteController.php+++ b/app/Http/Controllers/Auth/AcceptInviteController.php@@ -48,7 +48,7 @@ class AcceptInviteController extends Controllersession()->flash('flash.banner', __('settings.members.flash.wrong_email'));session()->flash('flash.bannerStyle', 'danger');- return redirect()->route('calendar');+ return redirect()->route('app.calendar');}// Check if already a member@@ -58,7 +58,7 @@ class AcceptInviteController extends Controllersession()->flash('flash.banner', __('settings.members.flash.already_member'));session()->flash('flash.bannerStyle', 'info');- return redirect()->route('calendar');+ return redirect()->route('app.calendar');}// Accept the invite@@ -69,7 +69,7 @@ class AcceptInviteController extends Controllersession()->flash('flash.banner', __('settings.members.flash.invite_accepted'));session()->flash('flash.bannerStyle', 'success');- return redirect()->route('calendar');+ return redirect()->route('app.calendar');}/**@@ -84,7 +84,7 @@ class AcceptInviteController extends Controllersession()->flash('flash.banner', __('settings.members.flash.wrong_email'));session()->flash('flash.bannerStyle', 'danger');- return redirect()->route('calendar');+ return redirect()->route('app.calendar');}$invite->delete();@@ -92,6 +92,6 @@ class AcceptInviteController extends Controllersession()->flash('flash.banner', __('settings.members.flash.invite_declined'));session()->flash('flash.bannerStyle', 'info');- return redirect()->route('calendar');+ return redirect()->route('app.calendar');}}diff --git a/app/Http/Controllers/Auth/AuthenticatedSessionController.php b/app/Http/Controllers/Auth/AuthenticatedSessionController.phpindex a93a85d10..c3ce6dd60 100644--- a/app/Http/Controllers/Auth/AuthenticatedSessionController.php+++ b/app/Http/Controllers/Auth/AuthenticatedSessionController.php@@ -40,7 +40,7 @@ class AuthenticatedSessionController extends Controllerreturn redirect($redirect);}- return redirect()->intended(route('calendar'));+ return redirect()->intended(route('app.calendar'));}/**diff --git a/app/Http/Controllers/Auth/BlueskyController.php b/app/Http/Controllers/Auth/BlueskyController.phpindex 68d031808..1ed869b78 100644--- a/app/Http/Controllers/Auth/BlueskyController.php+++ b/app/Http/Controllers/Auth/BlueskyController.php@@ -23,7 +23,7 @@ class BlueskyController extends SocialController$workspace = $request->user()->currentWorkspace;if (! $workspace) {- return redirect()->route('workspaces.create');+ return redirect()->route('app.workspaces.create');}$this->authorize('manageAccounts', $workspace);@@ -45,7 +45,7 @@ class BlueskyController extends SocialController$workspace = $request->user()->currentWorkspace;if (! $workspace) {- return redirect()->route('workspaces.create');+ return redirect()->route('app.workspaces.create');}$this->authorize('manageAccounts', $workspace);diff --git a/app/Http/Controllers/Auth/EmailVerificationNotificationController.php b/app/Http/Controllers/Auth/EmailVerificationNotificationController.phpindex bc769e679..4b28463b6 100644--- a/app/Http/Controllers/Auth/EmailVerificationNotificationController.php+++ b/app/Http/Controllers/Auth/EmailVerificationNotificationController.php@@ -16,7 +16,7 @@ class EmailVerificationNotificationController extends Controllerpublic function store(Request $request): RedirectResponse{if ($request->user()->hasVerifiedEmail()) {- return redirect()->intended(route('calendar'));+ return redirect()->intended(route('app.calendar'));}$request->user()->sendEmailVerificationNotification();diff --git a/app/Http/Controllers/Auth/EmailVerificationPromptController.php b/app/Http/Controllers/Auth/EmailVerificationPromptController.phpindex 6364157f3..016455048 100644--- a/app/Http/Controllers/Auth/EmailVerificationPromptController.php+++ b/app/Http/Controllers/Auth/EmailVerificationPromptController.php@@ -18,7 +18,7 @@ class EmailVerificationPromptController extends Controllerpublic function __invoke(Request $request): RedirectResponse|Response{return $request->user()->hasVerifiedEmail()- ? redirect()->intended(route('calendar'))+ ? redirect()->intended(route('app.calendar')): Inertia::render('auth/VerifyEmail', ['status' => session('status'),]);diff --git a/app/Http/Controllers/Auth/FacebookController.php b/app/Http/Controllers/Auth/FacebookController.phpindex 16972390f..0982e7dbc 100644--- a/app/Http/Controllers/Auth/FacebookController.php+++ b/app/Http/Controllers/Auth/FacebookController.php@@ -34,7 +34,7 @@ class FacebookController extends SocialController$workspace = $request->user()->currentWorkspace;if (! $workspace) {- return redirect()->route('workspaces.create');+ return redirect()->route('app.workspaces.create');}$this->authorize('manageAccounts', $workspace);@@ -159,7 +159,7 @@ class FacebookController extends SocialController],]);- return redirect()->route('social.facebook.select-page');+ return redirect()->route('app.social.facebook.select-page');} catch (\Exception $e) {Log::error('Facebook OAuth Error', ['error' => $e->getMessage(),@@ -179,7 +179,7 @@ class FacebookController extends SocialControllersession()->flash('flash.banner', __('accounts.flash.session_expired'));session()->flash('flash.bannerStyle', 'danger');- return redirect()->route('accounts');+ return redirect()->route('app.accounts');}$workspace = Workspace::find($workspaceId);@@ -188,7 +188,7 @@ class FacebookController extends SocialControllersession()->flash('flash.banner', __('accounts.flash.workspace_not_found'));session()->flash('flash.bannerStyle', 'danger');- return redirect()->route('accounts');+ return redirect()->route('app.accounts');}return Inertia::render('accounts/FacebookPageSelect', [diff --git a/app/Http/Controllers/Auth/InstagramController.php b/app/Http/Controllers/Auth/InstagramController.phpindex d26473caf..063565b30 100644--- a/app/Http/Controllers/Auth/InstagramController.php+++ b/app/Http/Controllers/Auth/InstagramController.php@@ -31,7 +31,7 @@ class InstagramController extends SocialController$workspace = $request->user()->currentWorkspace;if (! $workspace) {- return redirect()->route('workspaces.create');+ return redirect()->route('app.workspaces.create');}$this->authorize('manageAccounts', $workspace);diff --git a/app/Http/Controllers/Auth/LinkedInController.php b/app/Http/Controllers/Auth/LinkedInController.phpindex 89413d4b2..9bf1eb519 100644--- a/app/Http/Controllers/Auth/LinkedInController.php+++ b/app/Http/Controllers/Auth/LinkedInController.php@@ -34,7 +34,7 @@ class LinkedInController extends SocialController$workspace = $request->user()->currentWorkspace;if (! $workspace) {- return redirect()->route('workspaces.create');+ return redirect()->route('app.workspaces.create');}$this->authorize('manageAccounts', $workspace);diff --git a/app/Http/Controllers/Auth/LinkedInPageController.php b/app/Http/Controllers/Auth/LinkedInPageController.phpindex 6b151cead..1798f1d6f 100644--- a/app/Http/Controllers/Auth/LinkedInPageController.php+++ b/app/Http/Controllers/Auth/LinkedInPageController.php@@ -39,7 +39,7 @@ class LinkedInPageController extends SocialController$workspace = $request->user()->currentWorkspace;if (! $workspace) {- return redirect()->route('workspaces.create');+ return redirect()->route('app.workspaces.create');}$this->authorize('manageAccounts', $workspace);@@ -116,7 +116,7 @@ class LinkedInPageController extends SocialController],]);- return redirect()->route('social.linkedin-page.select-page');+ return redirect()->route('app.social.linkedin-page.select-page');} catch (\Exception $e) {Log::error('LinkedIn Page OAuth Error', ['error' => $e->getMessage(),@@ -134,7 +134,7 @@ class LinkedInPageController extends SocialControllersession()->flash('flash.banner', __('accounts.flash.session_expired'));session()->flash('flash.bannerStyle', 'danger');- return redirect()->route('accounts');+ return redirect()->route('app.accounts');}$workspace = Workspace::find($pendingData['workspace_id']);@@ -143,7 +143,7 @@ class LinkedInPageController extends SocialControllersession()->flash('flash.banner', __('accounts.flash.workspace_not_found'));session()->flash('flash.bannerStyle', 'danger');- return redirect()->route('accounts');+ return redirect()->route('app.accounts');}return Inertia::render('accounts/LinkedInPageSelect', [diff --git a/app/Http/Controllers/Auth/MastodonController.php b/app/Http/Controllers/Auth/MastodonController.phpindex 6613b2c81..1c2cef18b 100644--- a/app/Http/Controllers/Auth/MastodonController.php+++ b/app/Http/Controllers/Auth/MastodonController.php@@ -30,7 +30,7 @@ class MastodonController extends SocialController$workspace = $request->user()->currentWorkspace;if (! $workspace) {- return redirect()->route('workspaces.create');+ return redirect()->route('app.workspaces.create');}$this->authorize('manageAccounts', $workspace);@@ -54,7 +54,7 @@ class MastodonController extends SocialController$workspace = $request->user()->currentWorkspace;if (! $workspace) {- return redirect()->route('workspaces.create');+ return redirect()->route('app.workspaces.create');}$this->authorize('manageAccounts', $workspace);@@ -65,7 +65,7 @@ class MastodonController extends SocialController// Register app on the instance$appResponse = Http::post("{$instance}/api/v1/apps", ['client_name' => config('app.name'),- 'redirect_uris' => route('social.mastodon.callback'),+ 'redirect_uris' => route('app.social.mastodon.callback'),'scopes' => self::SCOPES,'website' => config('app.url'),]);@@ -96,7 +96,7 @@ class MastodonController extends SocialController$params = http_build_query(['client_id' => $app['client_id'],'response_type' => 'code',- 'redirect_uri' => route('social.mastodon.callback'),+ 'redirect_uri' => route('app.social.mastodon.callback'),'scope' => self::SCOPES,'state' => $state,]);@@ -149,7 +149,7 @@ class MastodonController extends SocialController'grant_type' => 'authorization_code','client_id' => $clientId,'client_secret' => $clientSecret,- 'redirect_uri' => route('social.mastodon.callback'),+ 'redirect_uri' => route('app.social.mastodon.callback'),'code' => $request->code,]);diff --git a/app/Http/Controllers/Auth/PinterestController.php b/app/Http/Controllers/Auth/PinterestController.phpindex 4f3359472..2eea12354 100644--- a/app/Http/Controllers/Auth/PinterestController.php+++ b/app/Http/Controllers/Auth/PinterestController.php@@ -33,7 +33,7 @@ class PinterestController extends SocialController$workspace = $request->user()->currentWorkspace;if (! $workspace) {- return redirect()->route('workspaces.create');+ return redirect()->route('app.workspaces.create');}$this->authorize('manageAccounts', $workspace);diff --git a/app/Http/Controllers/Auth/RegisteredUserController.php b/app/Http/Controllers/Auth/RegisteredUserController.phpindex 85284ffbf..956728362 100644--- a/app/Http/Controllers/Auth/RegisteredUserController.php+++ b/app/Http/Controllers/Auth/RegisteredUserController.php@@ -6,10 +6,10 @@ namespace App\Http\Controllers\Auth;use App\Enums\User\Setup;use App\Http\Controllers\Controller;-use App\Rules\Timezone;use App\Models\Language;use App\Models\User;use App\Models\Workspace;+use App\Rules\Timezone;use Illuminate\Auth\Events\Registered;use Illuminate\Http\RedirectResponse;use Illuminate\Http\Request;@@ -84,6 +84,6 @@ class RegisteredUserController extends Controllerreturn redirect($redirect);}- return redirect()->route('onboarding.step1');+ return redirect()->route('app.onboarding.step1');}}diff --git a/app/Http/Controllers/Auth/SocialController.php b/app/Http/Controllers/Auth/SocialController.phpindex f65737e5d..42dbf9ddc 100644--- a/app/Http/Controllers/Auth/SocialController.php+++ b/app/Http/Controllers/Auth/SocialController.php@@ -32,7 +32,7 @@ class SocialController extends Controller$workspace = $request->user()->currentWorkspace;if (! $workspace) {- return redirect()->route('workspaces.create');+ return redirect()->route('app.workspaces.create');}$this->authorize('view', $workspace);@@ -62,7 +62,7 @@ class SocialController extends Controller$workspace = $request->user()->currentWorkspace;if (! $workspace) {- return redirect()->route('workspaces.create');+ return redirect()->route('app.workspaces.create');}$this->authorize('manageAccounts', $workspace);@@ -84,7 +84,7 @@ class SocialController extends Controller$workspace = $request->user()->currentWorkspace;if (! $workspace) {- return redirect()->route('workspaces.create');+ return redirect()->route('app.workspaces.create');}session(['social_connect_workspace' => $workspace->id]);diff --git a/app/Http/Controllers/Auth/ThreadsController.php b/app/Http/Controllers/Auth/ThreadsController.phpindex d5a61b9c0..1653c8d85 100644--- a/app/Http/Controllers/Auth/ThreadsController.php+++ b/app/Http/Controllers/Auth/ThreadsController.php@@ -29,7 +29,7 @@ class ThreadsController extends SocialController$workspace = $request->user()->currentWorkspace;if (! $workspace) {- return redirect()->route('workspaces.create');+ return redirect()->route('app.workspaces.create');}$this->authorize('manageAccounts', $workspace);diff --git a/app/Http/Controllers/Auth/TikTokController.php b/app/Http/Controllers/Auth/TikTokController.phpindex 597a6cf5f..5cd3e7259 100644--- a/app/Http/Controllers/Auth/TikTokController.php+++ b/app/Http/Controllers/Auth/TikTokController.php@@ -31,7 +31,7 @@ class TikTokController extends SocialController$workspace = $request->user()->currentWorkspace;if (! $workspace) {- return redirect()->route('workspaces.create');+ return redirect()->route('app.workspaces.create');}$this->authorize('manageAccounts', $workspace);diff --git a/app/Http/Controllers/Auth/VerifyEmailController.php b/app/Http/Controllers/Auth/VerifyEmailController.phpindex 567e31d6d..aa17b64e6 100644--- a/app/Http/Controllers/Auth/VerifyEmailController.php+++ b/app/Http/Controllers/Auth/VerifyEmailController.php@@ -17,13 +17,13 @@ class VerifyEmailController extends Controllerpublic function __invoke(EmailVerificationRequest $request): RedirectResponse{if ($request->user()->hasVerifiedEmail()) {- return redirect()->intended(route('calendar').'?verified=1');+ return redirect()->intended(route('app.calendar').'?verified=1');}if ($request->user()->markEmailAsVerified()) {event(new Verified($request->user()));}- return redirect()->intended(route('calendar').'?verified=1');+ return redirect()->intended(route('app.calendar').'?verified=1');}}diff --git a/app/Http/Controllers/Auth/XController.php b/app/Http/Controllers/Auth/XController.phpindex 481dc9988..10b94f3ad 100644--- a/app/Http/Controllers/Auth/XController.php+++ b/app/Http/Controllers/Auth/XController.php@@ -29,7 +29,7 @@ class XController extends SocialController$workspace = $request->user()->currentWorkspace;if (! $workspace) {- return redirect()->route('workspaces.create');+ return redirect()->route('app.workspaces.create');}$this->authorize('manageAccounts', $workspace);diff --git a/app/Http/Controllers/Auth/YouTubeController.php b/app/Http/Controllers/Auth/YouTubeController.phpindex e5e07c74c..f81ecaf7b 100644--- a/app/Http/Controllers/Auth/YouTubeController.php+++ b/app/Http/Controllers/Auth/YouTubeController.php@@ -7,8 +7,10 @@ use App\Enums\SocialAccount\Status;use App\Models\Workspace;use Illuminate\Http\RedirectResponse;use Illuminate\Http\Request;+use Illuminate\Support\Facades\Http;use Illuminate\Support\Facades\Log;use Illuminate\View\View;+use Inertia\Inertia;use Laravel\Socialite\Facades\Socialite;use Symfony\Component\HttpFoundation\Response;@@ -31,7 +33,7 @@ class YouTubeController extends SocialController$workspace = $request->user()->currentWorkspace;if (! $workspace) {- return redirect()->route('workspaces.create');+ return redirect()->route('app.workspaces.create');}$this->authorize('manageAccounts', $workspace);@@ -150,7 +152,7 @@ class YouTubeController extends SocialController],]);- return redirect()->route('social.youtube.select-channel');+ return redirect()->route('app.social.youtube.select-channel');} catch (\Exception $e) {Log::error('YouTube OAuth Error', ['error' => $e->getMessage(),@@ -170,7 +172,7 @@ class YouTubeController extends SocialControllersession()->flash('flash.banner', __('accounts.flash.session_expired'));session()->flash('flash.bannerStyle', 'danger');- return redirect()->route('accounts');+ return redirect()->route('app.accounts');}$workspace = Workspace::find($workspaceId);@@ -179,7 +181,7 @@ class YouTubeController extends SocialControllersession()->flash('flash.banner', __('accounts.flash.workspace_not_found'));session()->flash('flash.bannerStyle', 'danger');- return redirect()->route('accounts');+ return redirect()->route('app.accounts');}// Fetch YouTube channels@@ -291,7 +293,7 @@ class YouTubeController extends SocialControllerprivate function redirectToGoogle(): Response{- return \Inertia\Inertia::location(+ return Inertia::location(Socialite::driver($this->driver)->scopes($this->scopes)->with([@@ -307,7 +309,7 @@ class YouTubeController extends SocialControllerprivate function fetchChannels(string $accessToken): array{try {- $response = \Illuminate\Support\Facades\Http::withToken($accessToken)+ $response = Http::withToken($accessToken)->get('https://www.googleapis.com/youtube/v3/channels', ['part' => 'snippet,contentDetails,statistics','mine' => 'true',diff --git a/app/Http/Middleware/Api/AuthenticateApiToken.php b/app/Http/Middleware/Api/AuthenticateApiToken.phpnew file mode 100644index 000000000..17cec3bf1--- /dev/null+++ b/app/Http/Middleware/Api/AuthenticateApiToken.php@@ -0,0 +1,47 @@+<?php++declare(strict_types=1);++namespace App\Http\Middleware\Api;++use App\Models\ApiToken;+use Closure;+use Illuminate\Http\Request;+use Illuminate\Support\Facades\Hash;+use Symfony\Component\HttpFoundation\Response;++class AuthenticateApiToken+{+ public function handle(Request $request, Closure $next): Response+ {+ $token = $request->bearerToken();++ if (! $token) {+ return response()->json(['message' => 'Missing API key.'], Response::HTTP_UNAUTHORIZED);+ }++ if (! str_starts_with($token, 'tp_') || strlen($token) !== 51) {+ return response()->json(['message' => 'Invalid API key.'], Response::HTTP_UNAUTHORIZED);+ }++ $lookup = substr($token, 3, 16);+ $apiToken = ApiToken::where('token_lookup', $lookup)->first();++ if (! $apiToken || ! Hash::check($token, $apiToken->token_hash)) {+ return response()->json(['message' => 'Invalid API key.'], Response::HTTP_UNAUTHORIZED);+ }++ if ($apiToken->status === 'expired') {+ return response()->json(['message' => 'API key has expired.'], Response::HTTP_UNAUTHORIZED);+ }++ $apiToken->update(['last_used_at' => now()]);++ $request->merge([+ 'workspace' => $apiToken->workspace,+ 'api_token' => $apiToken,+ ]);++ return $next($request);+ }+}diff --git a/app/Http/Middleware/EnsureSubscribed.php b/app/Http/Middleware/EnsureSubscribed.phpindex 8558d87dc..e5e5ec29d 100644--- a/app/Http/Middleware/EnsureSubscribed.php+++ b/app/Http/Middleware/EnsureSubscribed.php@@ -11,7 +11,7 @@ class EnsureSubscribed/*** Handle an incoming request.*- * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next+ * @param Closure(Request): (Response) $next*/public function handle(Request $request, Closure $next): Response{@@ -43,6 +43,6 @@ class EnsureSubscribed}// Redirect to subscription page- return redirect()->route('subscribe');+ return redirect()->route('app.subscribe');}}diff --git a/app/Http/Middleware/EnsureUserSetupIsComplete.php b/app/Http/Middleware/EnsureUserSetupIsComplete.phpindex 17ba7e3b2..2ad31d903 100644--- a/app/Http/Middleware/EnsureUserSetupIsComplete.php+++ b/app/Http/Middleware/EnsureUserSetupIsComplete.php@@ -12,7 +12,7 @@ class EnsureUserSetupIsComplete/*** Handle an incoming request.*- * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next+ * @param Closure(Request): (Response) $next*/public function handle(Request $request, Closure $next): Response{@@ -46,10 +46,10 @@ class EnsureUserSetupIsComplete// Redirect to appropriate stepreturn match ($user->setup) {- Setup::Role => redirect()->route('onboarding.step1'),- Setup::Connections => redirect()->route('onboarding.step2'),- Setup::Subscription => redirect()->route('onboarding.step2'),- default => redirect()->route('onboarding.step1'),+ Setup::Role => redirect()->route('app.onboarding.step1'),+ Setup::Connections => redirect()->route('app.onboarding.step2'),+ Setup::Subscription => redirect()->route('app.onboarding.step2'),+ default => redirect()->route('app.onboarding.step1'),};}}diff --git a/app/Http/Middleware/HandleAppearance.php b/app/Http/Middleware/HandleAppearance.phpindex f1a02bbc9..1a01684d8 100644--- a/app/Http/Middleware/HandleAppearance.php+++ b/app/Http/Middleware/HandleAppearance.php@@ -12,7 +12,7 @@ class HandleAppearance/*** Handle an incoming request.*- * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next+ * @param Closure(Request): (Response) $next*/public function handle(Request $request, Closure $next): Response{diff --git a/app/Http/Requests/Api/ApiKey/StoreApiKeyRequest.php b/app/Http/Requests/Api/ApiKey/StoreApiKeyRequest.phpnew file mode 100644index 000000000..404a552e5--- /dev/null+++ b/app/Http/Requests/Api/ApiKey/StoreApiKeyRequest.php@@ -0,0 +1,26 @@+<?php++declare(strict_types=1);++namespace App\Http\Requests\Api\ApiKey;++use Illuminate\Foundation\Http\FormRequest;++class StoreApiKeyRequest extends FormRequest+{+ public function authorize(): bool+ {+ return true;+ }++ /**+ * @return array<string, mixed>+ */+ public function rules(): array+ {+ return [+ 'name' => ['required', 'string', 'max:255'],+ 'expires_at' => ['nullable', 'date', 'after:today'],+ ];+ }+}diff --git a/app/Http/Requests/Api/Hashtag/StoreHashtagRequest.php b/app/Http/Requests/Api/Hashtag/StoreHashtagRequest.phpnew file mode 100644index 000000000..7e3ac2661--- /dev/null+++ b/app/Http/Requests/Api/Hashtag/StoreHashtagRequest.php@@ -0,0 +1,26 @@+<?php++declare(strict_types=1);++namespace App\Http\Requests\Api\Hashtag;++use Illuminate\Foundation\Http\FormRequest;++class StoreHashtagRequest extends FormRequest+{+ public function authorize(): bool+ {+ return true;+ }++ /**+ * @return array<string, mixed>+ */+ public function rules(): array+ {+ return [+ 'name' => ['required', 'string', 'max:255'],+ 'hashtags' => ['required', 'string'],+ ];+ }+}diff --git a/app/Http/Requests/Api/Hashtag/UpdateHashtagRequest.php b/app/Http/Requests/Api/Hashtag/UpdateHashtagRequest.phpnew file mode 100644index 000000000..15b484077--- /dev/null+++ b/app/Http/Requests/Api/Hashtag/UpdateHashtagRequest.php@@ -0,0 +1,26 @@+<?php++declare(strict_types=1);++namespace App\Http\Requests\Api\Hashtag;++use Illuminate\Foundation\Http\FormRequest;++class UpdateHashtagRequest extends FormRequest+{+ public function authorize(): bool+ {+ return true;+ }++ /**+ * @return array<string, mixed>+ */+ public function rules(): array+ {+ return [+ 'name' => ['required', 'string', 'max:255'],+ 'hashtags' => ['required', 'string'],+ ];+ }+}diff --git a/app/Http/Requests/Api/Label/StoreLabelRequest.php b/app/Http/Requests/Api/Label/StoreLabelRequest.phpnew file mode 100644index 000000000..eb30d9547--- /dev/null+++ b/app/Http/Requests/Api/Label/StoreLabelRequest.php@@ -0,0 +1,26 @@+<?php++declare(strict_types=1);++namespace App\Http\Requests\Api\Label;++use Illuminate\Foundation\Http\FormRequest;++class StoreLabelRequest extends FormRequest+{+ public function authorize(): bool+ {+ return true;+ }++ /**+ * @return array<string, mixed>+ */+ public function rules(): array+ {+ return [+ 'name' => ['required', 'string', 'max:255'],+ 'color' => ['required', 'string', 'max:7', 'regex:/^#[0-9A-Fa-f]{6}$/'],+ ];+ }+}diff --git a/app/Http/Requests/Api/Label/UpdateLabelRequest.php b/app/Http/Requests/Api/Label/UpdateLabelRequest.phpnew file mode 100644index 000000000..9cc9532ee--- /dev/null+++ b/app/Http/Requests/Api/Label/UpdateLabelRequest.php@@ -0,0 +1,26 @@+<?php++declare(strict_types=1);++namespace App\Http\Requests\Api\Label;++use Illuminate\Foundation\Http\FormRequest;++class UpdateLabelRequest extends FormRequest+{+ public function authorize(): bool+ {+ return true;+ }++ /**+ * @return array<string, mixed>+ */+ public function rules(): array+ {+ return [+ 'name' => ['required', 'string', 'max:255'],+ 'color' => ['required', 'string', 'max:7', 'regex:/^#[0-9A-Fa-f]{6}$/'],+ ];+ }+}diff --git a/app/Http/Requests/App/ApiKey/StoreApiKeyRequest.php b/app/Http/Requests/App/ApiKey/StoreApiKeyRequest.phpnew file mode 100644index 000000000..b4f881ca1--- /dev/null+++ b/app/Http/Requests/App/ApiKey/StoreApiKeyRequest.php@@ -0,0 +1,26 @@+<?php++declare(strict_types=1);++namespace App\Http\Requests\App\ApiKey;++use Illuminate\Foundation\Http\FormRequest;++class StoreApiKeyRequest extends FormRequest+{+ public function authorize(): bool+ {+ return true;+ }++ /**+ * @return array<string, mixed>+ */+ public function rules(): array+ {+ return [+ 'name' => ['required', 'string', 'max:255'],+ 'expires_at' => ['nullable', 'date', 'after:today'],+ ];+ }+}diff --git a/app/Http/Requests/App/Hashtag/StoreHashtagRequest.php b/app/Http/Requests/App/Hashtag/StoreHashtagRequest.phpnew file mode 100644index 000000000..860be3bde--- /dev/null+++ b/app/Http/Requests/App/Hashtag/StoreHashtagRequest.php@@ -0,0 +1,26 @@+<?php++declare(strict_types=1);++namespace App\Http\Requests\App\Hashtag;++use Illuminate\Foundation\Http\FormRequest;++class StoreHashtagRequest extends FormRequest+{+ public function authorize(): bool+ {+ return true;+ }++ /**+ * @return array<string, mixed>+ */+ public function rules(): array+ {+ return [+ 'name' => ['required', 'string', 'max:255'],+ 'hashtags' => ['required', 'string'],+ ];+ }+}diff --git a/app/Http/Requests/App/Label/StoreLabelRequest.php b/app/Http/Requests/App/Label/StoreLabelRequest.phpnew file mode 100644index 000000000..8f8d9d136--- /dev/null+++ b/app/Http/Requests/App/Label/StoreLabelRequest.php@@ -0,0 +1,26 @@+<?php++declare(strict_types=1);++namespace App\Http\Requests\App\Label;++use Illuminate\Foundation\Http\FormRequest;++class StoreLabelRequest extends FormRequest+{+ public function authorize(): bool+ {+ return true;+ }++ /**+ * @return array<string, mixed>+ */+ public function rules(): array+ {+ return [+ 'name' => ['required', 'string', 'max:255'],+ 'color' => ['required', 'string', 'max:7', 'regex:/^#[0-9A-Fa-f]{6}$/'],+ ];+ }+}diff --git a/app/Http/Requests/Auth/LoginRequest.php b/app/Http/Requests/Auth/LoginRequest.phpindex 7befcea5f..db82457c5 100644--- a/app/Http/Requests/Auth/LoginRequest.php+++ b/app/Http/Requests/Auth/LoginRequest.php@@ -5,6 +5,7 @@ declare(strict_types=1);namespace App\Http\Requests\Auth;use Illuminate\Auth\Events\Lockout;+use Illuminate\Contracts\Validation\Rule;use Illuminate\Foundation\Http\FormRequest;use Illuminate\Support\Facades\Auth;use Illuminate\Support\Facades\RateLimiter;@@ -24,7 +25,7 @@ class LoginRequest extends FormRequest/*** Get the validation rules that apply to the request.*- * @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>+ * @return array<string, Rule|array|string>*/public function rules(): array{@@ -37,7 +38,7 @@ class LoginRequest extends FormRequest/*** Attempt to authenticate the request's credentials.*- * @throws \Illuminate\Validation\ValidationException+ * @throws ValidationException*/public function authenticate(): void{@@ -57,7 +58,7 @@ class LoginRequest extends FormRequest/*** Ensure the login request is not rate limited.*- * @throws \Illuminate\Validation\ValidationException+ * @throws ValidationException*/public function ensureIsNotRateLimited(): void{diff --git a/app/Http/Requests/StoreWorkspaceInviteRequest.php b/app/Http/Requests/StoreWorkspaceInviteRequest.phpindex 73d549aab..f5027daab 100644--- a/app/Http/Requests/StoreWorkspaceInviteRequest.php+++ b/app/Http/Requests/StoreWorkspaceInviteRequest.php@@ -3,6 +3,7 @@namespace App\Http\Requests;use App\Enums\UserWorkspace\Role as WorkspaceRole;+use Illuminate\Contracts\Validation\ValidationRule;use Illuminate\Foundation\Http\FormRequest;use Illuminate\Validation\Rule;@@ -19,7 +20,7 @@ class StoreWorkspaceInviteRequest extends FormRequest/*** Get the validation rules that apply to the request.*- * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>+ * @return array<string, ValidationRule|array<mixed>|string>*/public function rules(): array{diff --git a/app/Http/Resources/Api/ApiKeyResource.php b/app/Http/Resources/Api/ApiKeyResource.phpnew file mode 100644index 000000000..e574c2a91--- /dev/null+++ b/app/Http/Resources/Api/ApiKeyResource.php@@ -0,0 +1,27 @@+<?php++declare(strict_types=1);++namespace App\Http\Resources\Api;++use Illuminate\Http\Request;+use Illuminate\Http\Resources\Json\JsonResource;++class ApiKeyResource extends JsonResource+{+ /**+ * @return array<string, mixed>+ */+ public function toArray(Request $request): array+ {+ return [+ 'id' => $this->id,+ 'name' => $this->name,+ 'key_hint' => $this->key_hint,+ 'status' => $this->status,+ 'last_used_at' => $this->last_used_at?->format('Y-m-d H:i:s'),+ 'expires_at' => $this->expires_at?->format('Y-m-d H:i:s'),+ 'created_at' => $this->created_at->format('Y-m-d H:i:s'),+ ];+ }+}diff --git a/app/Http/Resources/Api/HashtagResource.php b/app/Http/Resources/Api/HashtagResource.phpnew file mode 100644index 000000000..85ade0c5b--- /dev/null+++ b/app/Http/Resources/Api/HashtagResource.php@@ -0,0 +1,25 @@+<?php++declare(strict_types=1);++namespace App\Http\Resources\Api;++use Illuminate\Http\Request;+use Illuminate\Http\Resources\Json\JsonResource;++class HashtagResource extends JsonResource+{+ /**+ * @return array<string, mixed>+ */+ public function toArray(Request $request): array+ {+ return [+ 'id' => $this->id,+ 'name' => $this->name,+ 'hashtags' => $this->hashtags,+ 'created_at' => $this->created_at->format('Y-m-d H:i:s'),+ 'updated_at' => $this->updated_at->format('Y-m-d H:i:s'),+ ];+ }+}diff --git a/app/Http/Resources/Api/LabelResource.php b/app/Http/Resources/Api/LabelResource.phpnew file mode 100644index 000000000..b35a6eb5a--- /dev/null+++ b/app/Http/Resources/Api/LabelResource.php@@ -0,0 +1,25 @@+<?php++declare(strict_types=1);++namespace App\Http\Resources\Api;++use Illuminate\Http\Request;+use Illuminate\Http\Resources\Json\JsonResource;++class LabelResource extends JsonResource+{+ /**+ * @return array<string, mixed>+ */+ public function toArray(Request $request): array+ {+ return [+ 'id' => $this->id,+ 'name' => $this->name,+ 'color' => $this->color,+ 'created_at' => $this->created_at->format('Y-m-d H:i:s'),+ 'updated_at' => $this->updated_at->format('Y-m-d H:i:s'),+ ];+ }+}diff --git a/app/Http/Resources/Api/PostPlatformResource.php b/app/Http/Resources/Api/PostPlatformResource.phpnew file mode 100644index 000000000..b8939caba--- /dev/null+++ b/app/Http/Resources/Api/PostPlatformResource.php@@ -0,0 +1,27 @@+<?php++declare(strict_types=1);++namespace App\Http\Resources\Api;++use Illuminate\Http\Request;+use Illuminate\Http\Resources\Json\JsonResource;++class PostPlatformResource extends JsonResource+{+ /**+ * @return array<string, mixed>+ */+ public function toArray(Request $request): array+ {+ return [+ 'id' => $this->id,+ 'platform' => $this->platform,+ 'content' => $this->content,+ 'content_type' => $this->content_type,+ 'status' => $this->status,+ 'enabled' => $this->enabled,+ 'social_account' => new SocialAccountResource($this->whenLoaded('socialAccount')),+ ];+ }+}diff --git a/app/Http/Resources/Api/PostResource.php b/app/Http/Resources/Api/PostResource.phpnew file mode 100644index 000000000..34063b407--- /dev/null+++ b/app/Http/Resources/Api/PostResource.php@@ -0,0 +1,29 @@+<?php++declare(strict_types=1);++namespace App\Http\Resources\Api;++use Illuminate\Http\Request;+use Illuminate\Http\Resources\Json\JsonResource;++class PostResource extends JsonResource+{+ /**+ * @return array<string, mixed>+ */+ public function toArray(Request $request): array+ {+ return [+ 'id' => $this->id,+ 'status' => $this->status,+ 'synced' => $this->synced,+ 'scheduled_at' => $this->scheduled_at?->format('Y-m-d H:i:s'),+ 'published_at' => $this->published_at?->format('Y-m-d H:i:s'),+ 'platforms' => PostPlatformResource::collection($this->whenLoaded('postPlatforms')),+ 'labels' => LabelResource::collection($this->whenLoaded('labels')),+ 'created_at' => $this->created_at->format('Y-m-d H:i:s'),+ 'updated_at' => $this->updated_at->format('Y-m-d H:i:s'),+ ];+ }+}diff --git a/app/Http/Resources/Api/SocialAccountResource.php b/app/Http/Resources/Api/SocialAccountResource.phpnew file mode 100644index 000000000..e74382360--- /dev/null+++ b/app/Http/Resources/Api/SocialAccountResource.php@@ -0,0 +1,25 @@+<?php++declare(strict_types=1);++namespace App\Http\Resources\Api;++use Illuminate\Http\Request;+use Illuminate\Http\Resources\Json\JsonResource;++class SocialAccountResource extends JsonResource+{+ /**+ * @return array<string, mixed>+ */+ public function toArray(Request $request): array+ {+ return [+ 'id' => $this->id,+ 'platform' => $this->platform,+ 'name' => $this->name,+ 'username' => $this->username,+ 'avatar' => $this->avatar,+ ];+ }+}diff --git a/app/Http/Resources/Api/WorkspaceResource.php b/app/Http/Resources/Api/WorkspaceResource.phpnew file mode 100644index 000000000..b8a26f9fe--- /dev/null+++ b/app/Http/Resources/Api/WorkspaceResource.php@@ -0,0 +1,25 @@+<?php++declare(strict_types=1);++namespace App\Http\Resources\Api;++use Illuminate\Http\Request;+use Illuminate\Http\Resources\Json\JsonResource;++class WorkspaceResource extends JsonResource+{+ /**+ * @return array<string, mixed>+ */+ public function toArray(Request $request): array+ {+ return [+ 'id' => $this->id,+ 'name' => $this->name,+ 'timezone' => $this->timezone,+ 'created_at' => $this->created_at->format('Y-m-d H:i:s'),+ 'updated_at' => $this->updated_at->format('Y-m-d H:i:s'),+ ];+ }+}diff --git a/app/Mail/AccountDisconnected.php b/app/Mail/AccountDisconnected.phpindex 6c3fa7470..a5cbf04fe 100644--- a/app/Mail/AccountDisconnected.php+++ b/app/Mail/AccountDisconnected.php@@ -43,7 +43,7 @@ class AccountDisconnected extends Mailable implements ShouldQueue'platformName' => $platformName,'accountName' => $accountName,'workspaceName' => $workspaceName,- 'url' => route('accounts'),+ 'url' => route('app.accounts'),],);}diff --git a/app/Mail/WorkspaceConnectionsDisconnected.php b/app/Mail/WorkspaceConnectionsDisconnected.phpindex 5f764b796..8390f4817 100644--- a/app/Mail/WorkspaceConnectionsDisconnected.php+++ b/app/Mail/WorkspaceConnectionsDisconnected.php@@ -61,7 +61,7 @@ class WorkspaceConnectionsDisconnected extends Mailable implements ShouldQueue'buttonText' => __('mail.workspace_connections_disconnected.button', [], $locale),'workspace' => $this->workspace,'disconnectedAccounts' => $this->disconnectedAccounts,- 'url' => route('accounts'),+ 'url' => route('app.accounts'),],);}diff --git a/app/Mail/WorkspaceInvite.php b/app/Mail/WorkspaceInvite.phpindex e666f0dc7..47df0c7f7 100644--- a/app/Mail/WorkspaceInvite.php+++ b/app/Mail/WorkspaceInvite.php@@ -33,7 +33,7 @@ class WorkspaceInvite extends Mailable implements ShouldQueue'title' => "You've been invited to join {$this->invite->workspace->name}",'previewText' => "You've been invited to join {$this->invite->workspace->name}",'invite' => $this->invite,- 'url' => route('invites.show', $this->invite->id),+ 'url' => route('app.invites.show', $this->invite->id),],);}diff --git a/app/Models/ApiToken.php b/app/Models/ApiToken.phpnew file mode 100644index 000000000..e5dbacdf8--- /dev/null+++ b/app/Models/ApiToken.php@@ -0,0 +1,70 @@+<?php++declare(strict_types=1);++namespace App\Models;++use Illuminate\Database\Eloquent\Casts\Attribute;+use Illuminate\Database\Eloquent\Concerns\HasVersion4Uuids as HasUuids;+use Illuminate\Database\Eloquent\Factories\HasFactory;+use Illuminate\Database\Eloquent\Model;+use Illuminate\Database\Eloquent\Relations\BelongsTo;++class ApiToken extends Model+{+ use HasFactory, HasUuids;++ protected $table = 'api_tokens';++ protected $fillable = [+ 'workspace_id',+ 'name',+ 'token_lookup',+ 'token_hash',+ 'last_used_at',+ 'expires_at',+ ];++ protected $hidden = [+ 'token_lookup',+ 'token_hash',+ ];++ protected $appends = [+ 'status',+ 'key_hint',+ ];++ protected function casts(): array+ {+ return [+ 'last_used_at' => 'datetime',+ 'expires_at' => 'datetime',+ ];+ }++ public function workspace(): BelongsTo+ {+ return $this->belongsTo(Workspace::class);+ }++ protected function keyHint(): Attribute+ {+ return Attribute::make(+ get: fn () => 'tp_'.substr($this->token_lookup, 0, 8).'...',+ );+ }++ protected function status(): Attribute+ {+ return Attribute::make(+ get: function () {+ if ($this->expires_at === null) {+ return 'active';+ }++ return now()->greaterThan($this->expires_at) ? 'expired' : 'active';+ }+ );+ }+}diff --git a/app/Models/Media.php b/app/Models/Media.phpindex a397147a1..33031c0ab 100644--- a/app/Models/Media.php+++ b/app/Models/Media.php@@ -3,6 +3,7 @@namespace App\Models;use App\Enums\Media\Type as MediaType;+use Database\Factories\MediaFactory;use Illuminate\Database\Eloquent\Casts\Attribute;use Illuminate\Database\Eloquent\Concerns\HasUuids;use Illuminate\Database\Eloquent\Factories\HasFactory;@@ -12,7 +13,7 @@ use Illuminate\Support\Facades\Storage;class Media extends Model{- /** @use HasFactory<\Database\Factories\MediaFactory> */+ /** @use HasFactory<MediaFactory> */use HasFactory, HasUuids;protected $table = 'medias';diff --git a/app/Models/Post.php b/app/Models/Post.phpindex bcf891588..46546f50a 100644--- a/app/Models/Post.php+++ b/app/Models/Post.php@@ -3,6 +3,7 @@namespace App\Models;use App\Enums\Post\Status as PostStatus;+use Database\Factories\PostFactory;use Illuminate\Database\Eloquent\Builder;use Illuminate\Database\Eloquent\Concerns\HasUuids;use Illuminate\Database\Eloquent\Factories\HasFactory;@@ -13,7 +14,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;class Post extends Model{- /** @use HasFactory<\Database\Factories\PostFactory> */+ /** @use HasFactory<PostFactory> */use HasFactory, HasUuids;protected $fillable = [diff --git a/app/Models/PostPlatform.php b/app/Models/PostPlatform.phpindex 95ccee0ab..7c6e1f80c 100644--- a/app/Models/PostPlatform.php+++ b/app/Models/PostPlatform.php@@ -5,6 +5,7 @@ namespace App\Models;use App\Enums\PostPlatform\ContentType;use App\Enums\SocialAccount\Platform as SocialPlatform;use App\Models\Traits\HasMedia;+use Database\Factories\PostPlatformFactory;use Illuminate\Database\Eloquent\Concerns\HasUuids;use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\Model;@@ -12,7 +13,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;class PostPlatform extends Model{- /** @use HasFactory<\Database\Factories\PostPlatformFactory> */+ /** @use HasFactory<PostPlatformFactory> */use HasFactory, HasMedia, HasUuids;protected $fillable = [diff --git a/app/Models/SocialAccount.php b/app/Models/SocialAccount.phpindex 2e0b8af7c..531579497 100644--- a/app/Models/SocialAccount.php+++ b/app/Models/SocialAccount.php@@ -5,6 +5,7 @@ namespace App\Models;use App\Enums\SocialAccount\Platform as SocialPlatform;use App\Enums\SocialAccount\Status;use App\Mail\AccountDisconnected;+use Database\Factories\SocialAccountFactory;use Illuminate\Database\Eloquent\Casts\Attribute;use Illuminate\Database\Eloquent\Concerns\HasUuids;use Illuminate\Database\Eloquent\Factories\HasFactory;@@ -17,7 +18,7 @@ use Illuminate\Support\Facades\Storage;class SocialAccount extends Model{- /** @use HasFactory<\Database\Factories\SocialAccountFactory> */+ /** @use HasFactory<SocialAccountFactory> */use HasFactory, HasUuids;protected $fillable = [diff --git a/app/Models/User.php b/app/Models/User.phpindex 0fbd5e725..180b428df 100644--- a/app/Models/User.php+++ b/app/Models/User.php@@ -6,6 +6,7 @@ use App\Enums\User\Persona;use App\Enums\User\Setup;use App\Models\Traits\HasMedia;use App\Models\Traits\HasWorkspace;+use Database\Factories\UserFactory;use Illuminate\Contracts\Auth\MustVerifyEmail;use Illuminate\Database\Eloquent\Concerns\HasUuids;use Illuminate\Database\Eloquent\Factories\HasFactory;@@ -16,7 +17,7 @@ use Laravel\Cashier\Billable;class User extends Authenticatable implements MustVerifyEmail{- /** @use HasFactory<\Database\Factories\UserFactory> */+ /** @use HasFactory<UserFactory> */use Billable, HasFactory, HasMedia, HasUuids, HasWorkspace, Notifiable;/**diff --git a/app/Models/Workspace.php b/app/Models/Workspace.phpindex 93e754763..edc275ab0 100644--- a/app/Models/Workspace.php+++ b/app/Models/Workspace.php@@ -3,6 +3,7 @@namespace App\Models;use App\Models\Traits\HasMedia;+use Database\Factories\WorkspaceFactory;use Illuminate\Database\Eloquent\Concerns\HasUuids;use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\Model;@@ -12,7 +13,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;class Workspace extends Model{- /** @use HasFactory<\Database\Factories\WorkspaceFactory> */+ /** @use HasFactory<WorkspaceFactory> */use HasFactory, HasMedia, HasUuids;protected $fillable = [@@ -78,6 +79,11 @@ class Workspace extends Modelreturn $this->hasMany(WorkspaceLabel::class);}+ public function apiTokens(): HasMany+ {+ return $this->hasMany(ApiToken::class);+ }+public function hasMember(User $user): bool{return $this->user_id === $user->id || $this->members()->where('user_id', $user->id)->exists();diff --git a/app/Models/WorkspaceHashtag.php b/app/Models/WorkspaceHashtag.phpindex 269129d1a..b52e99154 100644--- a/app/Models/WorkspaceHashtag.php+++ b/app/Models/WorkspaceHashtag.php@@ -2,6 +2,7 @@namespace App\Models;+use Database\Factories\WorkspaceHashtagFactory;use Illuminate\Database\Eloquent\Concerns\HasUuids;use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\Model;@@ -10,7 +11,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;class WorkspaceHashtag extends Model{- /** @use HasFactory<\Database\Factories\WorkspaceHashtagFactory> */+ /** @use HasFactory<WorkspaceHashtagFactory> */use HasFactory, HasUuids, SoftDeletes;protected $fillable = [diff --git a/app/Models/WorkspaceInvite.php b/app/Models/WorkspaceInvite.phpindex 435149eed..ecf29360b 100644--- a/app/Models/WorkspaceInvite.php+++ b/app/Models/WorkspaceInvite.php@@ -5,6 +5,7 @@ declare(strict_types=1);namespace App\Models;use App\Enums\UserWorkspace\Role;+use Database\Factories\WorkspaceInviteFactory;use Illuminate\Database\Eloquent\Concerns\HasUuids;use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\Model;@@ -12,7 +13,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;class WorkspaceInvite extends Model{- /** @use HasFactory<\Database\Factories\WorkspaceInviteFactory> */+ /** @use HasFactory<WorkspaceInviteFactory> */use HasFactory, HasUuids;/**diff --git a/app/Models/WorkspaceLabel.php b/app/Models/WorkspaceLabel.phpindex 1a74ea882..691bf5357 100644--- a/app/Models/WorkspaceLabel.php+++ b/app/Models/WorkspaceLabel.php@@ -2,6 +2,7 @@namespace App\Models;+use Database\Factories\WorkspaceLabelFactory;use Illuminate\Database\Eloquent\Concerns\HasUuids;use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\Model;@@ -11,7 +12,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;class WorkspaceLabel extends Model{- /** @use HasFactory<\Database\Factories\WorkspaceLabelFactory> */+ /** @use HasFactory<WorkspaceLabelFactory> */use HasFactory, HasUuids, SoftDeletes;protected $fillable = [diff --git a/app/Rules/Timezone.php b/app/Rules/Timezone.phpindex 90301db05..2432498fe 100644--- a/app/Rules/Timezone.php+++ b/app/Rules/Timezone.php@@ -6,11 +6,12 @@ namespace App\Rules;use Closure;use Illuminate\Contracts\Validation\ValidationRule;+use Illuminate\Translation\PotentiallyTranslatedString;class Timezone implements ValidationRule{/**- * @param \Closure(string, ?string=): \Illuminate\Translation\PotentiallyTranslatedString $fail+ * @param Closure(string, ?string=): PotentiallyTranslatedString $fail*/public function validate(string $attribute, mixed $value, Closure $fail): void{diff --git a/bootstrap/app.php b/bootstrap/app.phpindex cb35c54b0..9d5756806 100644--- a/bootstrap/app.php+++ b/bootstrap/app.php@@ -1,5 +1,6 @@<?php+use App\Http\Middleware\Api\AuthenticateApiToken;use App\Http\Middleware\EnsureSubscribed;use App\Http\Middleware\HandleAppearance;use App\Http\Middleware\HandleInertiaRequests;@@ -7,18 +8,15 @@ use Illuminate\Foundation\Application;use Illuminate\Foundation\Configuration\Exceptions;use Illuminate\Foundation\Configuration\Middleware;use Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets;-use Illuminate\Support\Facades\Route;return Application::configure(basePath: dirname(__DIR__))->withRouting(web: __DIR__.'/../routes/web.php',+ api: __DIR__.'/../routes/api.php',+ apiPrefix: '',commands: __DIR__.'/../routes/console.php',channels: __DIR__.'/../routes/channels.php',health: '/up',- then: function () {- Route::middleware('web')- ->group(base_path('routes/auth.php'));- },)->withMiddleware(function (Middleware $middleware): void {$middleware->encryptCookies(except: ['appearance', 'sidebar_state']);@@ -31,6 +29,11 @@ return Application::configure(basePath: dirname(__DIR__))$middleware->alias(['subscribed' => EnsureSubscribed::class,+ 'api.auth' => AuthenticateApiToken::class,+ ]);++ $middleware->validateCsrfTokens(except: [+ 'stripe/*',]);})->withExceptions(function (Exceptions $exceptions): void {diff --git a/bootstrap/providers.php b/bootstrap/providers.phpindex 4e3b44075..2345aa62f 100644--- a/bootstrap/providers.php+++ b/bootstrap/providers.php@@ -1,6 +1,9 @@<?php+use App\Providers\AppServiceProvider;+use App\Providers\HorizonServiceProvider;+return [- App\Providers\AppServiceProvider::class,- App\Providers\HorizonServiceProvider::class,+ AppServiceProvider::class,+ HorizonServiceProvider::class,];diff --git a/config/auth.php b/config/auth.phpindex 7d1eb0de5..d7568ff19 100644--- a/config/auth.php+++ b/config/auth.php@@ -1,5 +1,7 @@<?php+use App\Models\User;+return [/*@@ -62,7 +64,7 @@ return ['providers' => ['users' => ['driver' => 'eloquent',- 'model' => env('AUTH_MODEL', App\Models\User::class),+ 'model' => env('AUTH_MODEL', User::class),],// 'users' => [diff --git a/config/database.php b/config/database.phpindex c15e8c4a9..ee12bd3d8 100644--- a/config/database.php+++ b/config/database.php@@ -1,6 +1,7 @@<?phpuse Illuminate\Support\Str;+use Pdo\Mysql;return [@@ -59,7 +60,7 @@ return ['strict' => true,'engine' => null,'options' => extension_loaded('pdo_mysql') ? array_filter([- (PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),+ (PHP_VERSION_ID >= 80500 ? Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),]) : [],],@@ -79,7 +80,7 @@ return ['strict' => true,'engine' => null,'options' => extension_loaded('pdo_mysql') ? array_filter([- (PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),+ (PHP_VERSION_ID >= 80500 ? Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),]) : [],],diff --git a/database/factories/LanguageFactory.php b/database/factories/LanguageFactory.phpindex 318bbe9be..0357c6335 100644--- a/database/factories/LanguageFactory.php+++ b/database/factories/LanguageFactory.php@@ -2,10 +2,11 @@namespace Database\Factories;+use App\Models\Language;use Illuminate\Database\Eloquent\Factories\Factory;/**- * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Language>+ * @extends Factory<Language>*/class LanguageFactory extends Factory{diff --git a/database/factories/MediaFactory.php b/database/factories/MediaFactory.phpindex 94c143158..2760ce40a 100644--- a/database/factories/MediaFactory.php+++ b/database/factories/MediaFactory.php@@ -7,7 +7,7 @@ use App\Models\Media;use Illuminate\Database\Eloquent\Factories\Factory;/**- * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Media>+ * @extends Factory<Media>*/class MediaFactory extends Factory{diff --git a/database/factories/PostFactory.php b/database/factories/PostFactory.phpindex c5188ec0e..1e67d8eb5 100644--- a/database/factories/PostFactory.php+++ b/database/factories/PostFactory.php@@ -3,12 +3,13 @@namespace Database\Factories;use App\Enums\Post\Status as PostStatus;+use App\Models\Post;use App\Models\User;use App\Models\Workspace;use Illuminate\Database\Eloquent\Factories\Factory;/**- * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Post>+ * @extends Factory<Post>*/class PostFactory extends Factory{diff --git a/database/factories/PostPlatformFactory.php b/database/factories/PostPlatformFactory.phpindex 95557b2c6..a71981624 100644--- a/database/factories/PostPlatformFactory.php+++ b/database/factories/PostPlatformFactory.php@@ -5,11 +5,12 @@ namespace Database\Factories;use App\Enums\PostPlatform\ContentType;use App\Enums\SocialAccount\Platform;use App\Models\Post;+use App\Models\PostPlatform;use App\Models\SocialAccount;use Illuminate\Database\Eloquent\Factories\Factory;/**- * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\PostPlatform>+ * @extends Factory<PostPlatform>*/class PostPlatformFactory extends Factory{diff --git a/database/factories/SocialAccountFactory.php b/database/factories/SocialAccountFactory.phpindex b0d2e20ae..d9a111c57 100644--- a/database/factories/SocialAccountFactory.php+++ b/database/factories/SocialAccountFactory.php@@ -4,11 +4,12 @@ namespace Database\Factories;use App\Enums\SocialAccount\Platform;use App\Enums\SocialAccount\Status;+use App\Models\SocialAccount;use App\Models\Workspace;use Illuminate\Database\Eloquent\Factories\Factory;/**- * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\SocialAccount>+ * @extends Factory<SocialAccount>*/class SocialAccountFactory extends Factory{diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.phpindex cba2d87bc..6082d653f 100644--- a/database/factories/UserFactory.php+++ b/database/factories/UserFactory.php@@ -3,12 +3,13 @@namespace Database\Factories;use App\Models\Language;+use App\Models\User;use Illuminate\Database\Eloquent\Factories\Factory;use Illuminate\Support\Facades\Hash;use Illuminate\Support\Str;/**- * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>+ * @extends Factory<User>*/class UserFactory extends Factory{diff --git a/database/factories/WorkspaceFactory.php b/database/factories/WorkspaceFactory.phpindex 6de65ad6e..b7b285de3 100644--- a/database/factories/WorkspaceFactory.php+++ b/database/factories/WorkspaceFactory.php@@ -3,10 +3,11 @@namespace Database\Factories;use App\Models\User;+use App\Models\Workspace;use Illuminate\Database\Eloquent\Factories\Factory;/**- * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Workspace>+ * @extends Factory<Workspace>*/class WorkspaceFactory extends Factory{diff --git a/database/factories/WorkspaceHashtagFactory.php b/database/factories/WorkspaceHashtagFactory.phpindex 93de23f86..adda2f0d5 100644--- a/database/factories/WorkspaceHashtagFactory.php+++ b/database/factories/WorkspaceHashtagFactory.php@@ -3,10 +3,11 @@namespace Database\Factories;use App\Models\Workspace;+use App\Models\WorkspaceHashtag;use Illuminate\Database\Eloquent\Factories\Factory;/**- * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\WorkspaceHashtag>+ * @extends Factory<WorkspaceHashtag>*/class WorkspaceHashtagFactory extends Factory{diff --git a/database/factories/WorkspaceInviteFactory.php b/database/factories/WorkspaceInviteFactory.phpindex 5a810e945..f5d86192f 100644--- a/database/factories/WorkspaceInviteFactory.php+++ b/database/factories/WorkspaceInviteFactory.php@@ -4,10 +4,11 @@ namespace Database\Factories;use App\Enums\UserWorkspace\Role;use App\Models\Workspace;+use App\Models\WorkspaceInvite;use Illuminate\Database\Eloquent\Factories\Factory;/**- * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\WorkspaceInvite>+ * @extends Factory<WorkspaceInvite>*/class WorkspaceInviteFactory extends Factory{diff --git a/database/factories/WorkspaceLabelFactory.php b/database/factories/WorkspaceLabelFactory.phpindex 064251fc9..3fc0a7859 100644--- a/database/factories/WorkspaceLabelFactory.php+++ b/database/factories/WorkspaceLabelFactory.php@@ -3,10 +3,11 @@namespace Database\Factories;use App\Models\Workspace;+use App\Models\WorkspaceLabel;use Illuminate\Database\Eloquent\Factories\Factory;/**- * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\WorkspaceLabel>+ * @extends Factory<WorkspaceLabel>*/class WorkspaceLabelFactory extends Factory{diff --git a/database/migrations/2026_03_29_215341_create_api_tokens_table.php b/database/migrations/2026_03_29_215341_create_api_tokens_table.phpnew file mode 100644index 000000000..1390506ab--- /dev/null+++ b/database/migrations/2026_03_29_215341_create_api_tokens_table.php@@ -0,0 +1,29 @@+<?php++declare(strict_types=1);++use Illuminate\Database\Migrations\Migration;+use Illuminate\Database\Schema\Blueprint;+use Illuminate\Support\Facades\Schema;++return new class extends Migration+{+ public function up(): void+ {+ Schema::create('api_tokens', function (Blueprint $table) {+ $table->uuid('id')->primary();+ $table->foreignUuid('workspace_id')->constrained()->cascadeOnDelete();+ $table->string('name');+ $table->string('token_lookup', 16)->unique();+ $table->string('token_hash', 255);+ $table->timestamp('last_used_at')->nullable();+ $table->timestamp('expires_at')->nullable();+ $table->timestamps();+ });+ }++ public function down(): void+ {+ Schema::dropIfExists('api_tokens');+ }+};diff --git a/lang/pt-br/passwords.php b/lang/pt-br/passwords.phpindex 49fa8f071..600b63b89 100644--- a/lang/pt-br/passwords.php+++ b/lang/pt-br/passwords.php@@ -17,6 +17,6 @@ return ['sent' => 'Enviamos o link de redefinição de senha por e-mail.','throttled' => 'Por favor, aguarde antes de tentar novamente.','token' => 'Este token de redefinição de senha é inválido.',- 'user' => "Não conseguimos encontrar um usuário com esse endereço de e-mail.",+ 'user' => 'Não conseguimos encontrar um usuário com esse endereço de e-mail.',];diff --git a/routes/api.php b/routes/api.phpnew file mode 100644index 000000000..875a65645--- /dev/null+++ b/routes/api.php@@ -0,0 +1,45 @@+<?php++declare(strict_types=1);++use App\Http\Controllers\Api\ApiKeyController;+use App\Http\Controllers\Api\HashtagController;+use App\Http\Controllers\Api\LabelController;+use App\Http\Controllers\Api\PostController;+use App\Http\Controllers\Api\WorkspaceController;+use Illuminate\Support\Facades\Route;++Route::group(+ [+ 'domain' => 'api.'.parse_url(config('app.url'), PHP_URL_HOST),+ 'middleware' => ['api.auth'],+ ],+ function () {+ // Posts+ Route::get('/posts', [PostController::class, 'index'])->name('api.posts.index');+ Route::post('/posts', [PostController::class, 'store'])->name('api.posts.store');+ Route::get('/posts/{post}', [PostController::class, 'show'])->name('api.posts.show');+ Route::put('/posts/{post}', [PostController::class, 'update'])->name('api.posts.update');+ Route::delete('/posts/{post}', [PostController::class, 'destroy'])->name('api.posts.destroy');++ // Workspace+ Route::get('/workspace', [WorkspaceController::class, 'show'])->name('api.workspace.show');++ // Hashtags+ Route::get('/hashtags', [HashtagController::class, 'index'])->name('api.hashtags.index');+ Route::post('/hashtags', [HashtagController::class, 'store'])->name('api.hashtags.store');+ Route::put('/hashtags/{hashtag}', [HashtagController::class, 'update'])->name('api.hashtags.update');+ Route::delete('/hashtags/{hashtag}', [HashtagController::class, 'destroy'])->name('api.hashtags.destroy');++ // Labels+ Route::get('/labels', [LabelController::class, 'index'])->name('api.labels.index');+ Route::post('/labels', [LabelController::class, 'store'])->name('api.labels.store');+ Route::put('/labels/{label}', [LabelController::class, 'update'])->name('api.labels.update');+ Route::delete('/labels/{label}', [LabelController::class, 'destroy'])->name('api.labels.destroy');++ // API Keys+ Route::get('/api-keys', [ApiKeyController::class, 'index'])->name('api.api-keys.index');+ Route::post('/api-keys', [ApiKeyController::class, 'store'])->name('api.api-keys.store');+ Route::delete('/api-keys/{apiToken}', [ApiKeyController::class, 'destroy'])->name('api.api-keys.destroy');+ }+);diff --git a/routes/app.php b/routes/app.phpnew file mode 100644index 000000000..e5aec5a42--- /dev/null+++ b/routes/app.php@@ -0,0 +1,179 @@+<?php++declare(strict_types=1);++use App\Http\Controllers\App\ApiKeyController;+use App\Http\Controllers\App\BillingController;+use App\Http\Controllers\App\MediaController;+use App\Http\Controllers\App\OnboardingController;+use App\Http\Controllers\App\PostController;+use App\Http\Controllers\App\Settings\PasswordController;+use App\Http\Controllers\App\Settings\ProfileController;+use App\Http\Controllers\App\WorkspaceController;+use App\Http\Controllers\App\WorkspaceHashtagController;+use App\Http\Controllers\App\WorkspaceInviteController;+use App\Http\Controllers\App\WorkspaceLabelController;+use App\Http\Controllers\Auth\BlueskyController;+use App\Http\Controllers\Auth\FacebookController;+use App\Http\Controllers\Auth\InstagramController;+use App\Http\Controllers\Auth\LinkedInController;+use App\Http\Controllers\Auth\LinkedInPageController;+use App\Http\Controllers\Auth\MastodonController;+use App\Http\Controllers\Auth\PinterestController;+use App\Http\Controllers\Auth\SocialController;+use App\Http\Controllers\Auth\ThreadsController;+use App\Http\Controllers\Auth\TikTokController;+use App\Http\Controllers\Auth\XController;+use App\Http\Controllers\Auth\YouTubeController;+use App\Http\Middleware\EnsureUserSetupIsComplete;+use Illuminate\Support\Facades\Route;++Route::group(+ [+ 'domain' => 'app.'.parse_url(config('app.url'), PHP_URL_HOST),+ 'middleware' => ['web'],+ ],+ function () {+ Route::get('/', function () {+ return redirect()->route('app.calendar');+ })->name('app.home')->middleware(['auth', 'verified']);++ // Subscription selection (requires auth but not subscription)+ Route::middleware(['auth', 'verified'])->group(function () {+ Route::get('subscribe', [BillingController::class, 'subscribe'])->name('app.subscribe');+ Route::post('billing/checkout', [BillingController::class, 'checkout'])->name('app.billing.checkout');+ Route::get('billing/processing', [BillingController::class, 'processing'])->name('app.billing.processing');+ });++ // Onboarding routes+ Route::middleware(['auth', 'verified'])->prefix('onboarding')->group(function () {+ Route::get('step1', [OnboardingController::class, 'step1'])->name('app.onboarding.step1');+ Route::post('step1', [OnboardingController::class, 'storeStep1'])->name('app.onboarding.step1.store');+ Route::get('step2', [OnboardingController::class, 'step2'])->name('app.onboarding.step2');+ Route::post('step2', [OnboardingController::class, 'storeStep2'])->name('app.onboarding.step2.store');+ Route::get('complete', [OnboardingController::class, 'complete'])->name('app.onboarding.complete');+ });++ // Social Connect routes+ Route::middleware(['auth', 'verified'])->group(function () {+ Route::get('connect/linkedin', [LinkedInController::class, 'connect'])->name('app.social.linkedin.connect');+ Route::get('accounts/linkedin/callback', [LinkedInController::class, 'callback'])->name('app.social.linkedin.callback');++ Route::get('connect/linkedin-page', [LinkedInPageController::class, 'connect'])->name('app.social.linkedin-page.connect');+ Route::get('accounts/linkedin-page/callback', [LinkedInPageController::class, 'callback'])->name('app.social.linkedin-page.callback');+ Route::get('accounts/linkedin-page/select', [LinkedInPageController::class, 'selectPage'])->name('app.social.linkedin-page.select-page');+ Route::post('accounts/linkedin-page/select', [LinkedInPageController::class, 'select'])->name('app.social.linkedin-page.select');++ Route::get('connect/x', [XController::class, 'connect'])->name('app.social.x.connect');+ Route::get('accounts/x/callback', [XController::class, 'callback'])->name('app.social.x.callback');++ Route::get('connect/tiktok', [TikTokController::class, 'connect'])->name('app.social.tiktok.connect');+ Route::get('accounts/tiktok/callback', [TikTokController::class, 'callback'])->name('app.social.tiktok.callback');++ Route::get('connect/youtube', [YouTubeController::class, 'connect'])->name('app.social.youtube.connect');+ Route::get('accounts/youtube/callback', [YouTubeController::class, 'callback'])->name('app.social.youtube.callback');+ Route::get('accounts/youtube/select', [YouTubeController::class, 'selectChannel'])->name('app.social.youtube.select-channel');+ Route::post('accounts/youtube/select', [YouTubeController::class, 'select'])->name('app.social.youtube.select');++ Route::get('connect/facebook', [FacebookController::class, 'connect'])->name('app.social.facebook.connect');+ Route::get('accounts/facebook/callback', [FacebookController::class, 'callback'])->name('app.social.facebook.callback');+ Route::get('accounts/facebook/select', [FacebookController::class, 'selectPage'])->name('app.social.facebook.select-page');+ Route::post('accounts/facebook/select', [FacebookController::class, 'select'])->name('app.social.facebook.select');++ Route::get('connect/instagram', [InstagramController::class, 'connect'])->name('app.social.instagram.connect');+ Route::get('accounts/instagram/callback', [InstagramController::class, 'callback'])->name('app.social.instagram.callback');+ Route::get('accounts/instagram/select', [InstagramController::class, 'selectAccount'])->name('app.social.instagram.select-account');+ Route::post('accounts/instagram/select', [InstagramController::class, 'select'])->name('app.social.instagram.select');++ Route::get('connect/threads', [ThreadsController::class, 'connect'])->name('app.social.threads.connect');+ Route::get('accounts/threads/callback', [ThreadsController::class, 'callback'])->name('app.social.threads.callback');++ Route::get('connect/pinterest', [PinterestController::class, 'connect'])->name('app.social.pinterest.connect');+ Route::get('accounts/pinterest/callback', [PinterestController::class, 'callback'])->name('app.social.pinterest.callback');++ Route::get('connect/bluesky', [BlueskyController::class, 'connect'])->name('app.social.bluesky.connect');+ Route::post('connect/bluesky', [BlueskyController::class, 'store'])->name('app.social.bluesky.store');++ Route::get('connect/mastodon', [MastodonController::class, 'connect'])->name('app.social.mastodon.connect');+ Route::post('connect/mastodon', [MastodonController::class, 'authorizeInstance'])->name('app.social.mastodon.authorize');+ Route::get('accounts/mastodon/callback', [MastodonController::class, 'callback'])->name('app.social.mastodon.callback');+ });++ // Routes that require active subscription and completed onboarding+ Route::middleware(['auth', 'verified', 'subscribed', EnsureUserSetupIsComplete::class])->group(function () {+ // Workspaces+ Route::get('workspaces', [WorkspaceController::class, 'index'])->name('app.workspaces.index');+ Route::get('workspaces/create', [WorkspaceController::class, 'create'])->name('app.workspaces.create');+ Route::post('workspaces', [WorkspaceController::class, 'store'])->name('app.workspaces.store');+ Route::post('workspaces/{workspace}/switch', [WorkspaceController::class, 'switch'])->name('app.workspaces.switch');+ Route::delete('workspaces/{workspace}', [WorkspaceController::class, 'destroy'])->name('app.workspaces.destroy');++ // Workspace settings+ Route::get('settings/workspace', [WorkspaceController::class, 'settings'])->name('app.workspace.settings');+ Route::put('settings/workspace', [WorkspaceController::class, 'updateSettings'])->name('app.workspace.settings.update');++ // Social Accounts+ Route::get('accounts', [SocialController::class, 'index'])->name('app.accounts');+ Route::delete('accounts/{account}', [SocialController::class, 'disconnect'])->name('app.accounts.disconnect');++ // Calendar+ Route::get('calendar', [PostController::class, 'calendar'])->name('app.calendar');++ // Posts+ Route::get('posts/{status?}', [PostController::class, 'index'])->name('app.posts.index')->where('status', 'draft|scheduled|published');+ Route::post('posts', [PostController::class, 'store'])->name('app.posts.store');+ Route::get('posts/{post}/edit', [PostController::class, 'edit'])->name('app.posts.edit');+ Route::put('posts/{post}', [PostController::class, 'update'])->name('app.posts.update');+ Route::delete('posts/{post}', [PostController::class, 'destroy'])->name('app.posts.destroy');++ // Media+ Route::post('medias', [MediaController::class, 'store'])->name('app.medias.store');+ Route::post('medias/chunked', [MediaController::class, 'storeChunked'])->name('app.medias.store-chunked');+ Route::post('medias/reorder', [MediaController::class, 'reorder'])->name('app.medias.reorder');+ Route::post('medias/{media}/duplicate', [MediaController::class, 'duplicate'])->name('app.medias.duplicate');+ Route::delete('medias/{modelId}/{media}', [MediaController::class, 'destroy'])->name('app.medias.destroy');++ // Members+ Route::get('settings/members', [WorkspaceInviteController::class, 'index'])->name('app.members');+ Route::post('settings/members/invites', [WorkspaceInviteController::class, 'store'])->name('app.invites.store');+ Route::delete('settings/members/invites/{invite}', [WorkspaceInviteController::class, 'destroy'])->name('app.invites.destroy');+ Route::delete('settings/members/{user}', [WorkspaceInviteController::class, 'removeMember'])->name('app.members.remove');++ // Hashtags+ Route::get('hashtags', [WorkspaceHashtagController::class, 'index'])->name('app.hashtags.index');+ Route::post('hashtags', [WorkspaceHashtagController::class, 'store'])->name('app.hashtags.store');+ Route::put('hashtags/{hashtag}', [WorkspaceHashtagController::class, 'update'])->name('app.hashtags.update');+ Route::delete('hashtags/{hashtag}', [WorkspaceHashtagController::class, 'destroy'])->name('app.hashtags.destroy');++ // Labels+ Route::get('labels', [WorkspaceLabelController::class, 'index'])->name('app.labels.index');+ Route::post('labels', [WorkspaceLabelController::class, 'store'])->name('app.labels.store');+ Route::put('labels/{label}', [WorkspaceLabelController::class, 'update'])->name('app.labels.update');+ Route::delete('labels/{label}', [WorkspaceLabelController::class, 'destroy'])->name('app.labels.destroy');++ // API Keys+ Route::get('api-keys', [ApiKeyController::class, 'index'])->name('app.api-keys.index');+ Route::post('api-keys', [ApiKeyController::class, 'store'])->name('app.api-keys.store');+ Route::delete('api-keys/{apiToken}', [ApiKeyController::class, 'destroy'])->name('app.api-keys.destroy');++ // Billing+ Route::get('settings/billing', [BillingController::class, 'index'])->name('app.billing.index');+ Route::get('settings/billing/portal', [BillingController::class, 'portal'])->name('app.billing.portal');+ });++ // Settings (auth required)+ Route::middleware(['auth'])->group(function () {+ Route::get('settings/profile', [ProfileController::class, 'edit'])->name('app.profile.edit');+ Route::patch('settings/profile', [ProfileController::class, 'update'])->name('app.profile.update');+ Route::patch('settings/language', [ProfileController::class, 'updateLanguage'])->name('app.profile.language');+ });++ Route::middleware(['auth', 'verified'])->group(function () {+ Route::delete('settings/profile', [ProfileController::class, 'destroy'])->name('app.profile.destroy');+ Route::get('settings/password', [PasswordController::class, 'edit'])->name('app.user-password.edit');+ Route::put('settings/password', [PasswordController::class, 'update'])+ ->middleware('throttle:6,1')+ ->name('app.user-password.update');+ });+ }+);diff --git a/routes/auth.php b/routes/auth.phpindex be29bbc3f..2ac434dbb 100644--- a/routes/auth.php+++ b/routes/auth.php@@ -12,35 +12,44 @@ use App\Http\Controllers\Auth\RegisteredUserController;use App\Http\Controllers\Auth\VerifyEmailController;use Illuminate\Support\Facades\Route;-Route::middleware('guest')->group(function () {- Route::get('/register', [RegisteredUserController::class, 'create'])->name('register');- Route::post('/register', [RegisteredUserController::class, 'store'])->name('register.store');+Route::group(+ [+ 'domain' => 'app.'.parse_url(config('app.url'), PHP_URL_HOST),+ 'middleware' => ['web'],+ ],+ function () {- Route::get('/login', [AuthenticatedSessionController::class, 'create'])->name('login');- Route::post('/login', [AuthenticatedSessionController::class, 'store'])->name('login.store');+ Route::middleware('guest')->group(function () {+ Route::get('/register', [RegisteredUserController::class, 'create'])->name('register');+ Route::post('/register', [RegisteredUserController::class, 'store'])->name('register.store');- Route::get('/forgot-password', [PasswordResetLinkController::class, 'create'])->name('password.request');- Route::post('/forgot-password', [PasswordResetLinkController::class, 'store'])->name('password.email');+ Route::get('/login', [AuthenticatedSessionController::class, 'create'])->name('login');+ Route::post('/login', [AuthenticatedSessionController::class, 'store'])->name('login.store');- Route::get('/reset-password/{token}', [NewPasswordController::class, 'create'])->name('password.reset');- Route::post('/reset-password', [NewPasswordController::class, 'store'])->name('password.store');-});+ Route::get('/forgot-password', [PasswordResetLinkController::class, 'create'])->name('password.request');+ Route::post('/forgot-password', [PasswordResetLinkController::class, 'store'])->name('password.email');-// Invite routes - accessible by both guests and authenticated users-Route::get('/invites/{invite}', [AcceptInviteController::class, 'show'])->name('invites.show');-Route::post('/invites/{invite}/accept', [AcceptInviteController::class, 'accept'])->name('invites.accept')->middleware('auth');-Route::post('/invites/{invite}/decline', [AcceptInviteController::class, 'decline'])->name('invites.decline')->middleware('auth');+ Route::get('/reset-password/{token}', [NewPasswordController::class, 'create'])->name('password.reset');+ Route::post('/reset-password', [NewPasswordController::class, 'store'])->name('password.store');+ });-Route::middleware('auth')->group(function () {- Route::get('/verify-email', EmailVerificationPromptController::class)->name('verification.notice');+ // Invite routes - accessible by both guests and authenticated users+ Route::get('/invites/{invite}', [AcceptInviteController::class, 'show'])->name('app.invites.show');+ Route::post('/invites/{invite}/accept', [AcceptInviteController::class, 'accept'])->name('app.invites.accept')->middleware('auth');+ Route::post('/invites/{invite}/decline', [AcceptInviteController::class, 'decline'])->name('app.invites.decline')->middleware('auth');- Route::get('/verify-email/{id}/{hash}', VerifyEmailController::class)- ->middleware(['signed', 'throttle:6,1'])- ->name('verification.verify');+ Route::middleware('auth')->group(function () {+ Route::get('/verify-email', EmailVerificationPromptController::class)->name('verification.notice');- Route::post('/email/verification-notification', [EmailVerificationNotificationController::class, 'store'])- ->middleware('throttle:6,1')- ->name('verification.send');+ Route::get('/verify-email/{id}/{hash}', VerifyEmailController::class)+ ->middleware(['signed', 'throttle:6,1'])+ ->name('verification.verify');- Route::post('/logout', [AuthenticatedSessionController::class, 'destroy'])->name('logout');-});+ Route::post('/email/verification-notification', [EmailVerificationNotificationController::class, 'store'])+ ->middleware('throttle:6,1')+ ->name('verification.send');++ Route::post('/logout', [AuthenticatedSessionController::class, 'destroy'])->name('logout');+ });++ }); // end domain groupdiff --git a/routes/web.php b/routes/web.phpindex 4986a5d3d..0086ce7ed 100644--- a/routes/web.php+++ b/routes/web.php@@ -1,148 +1,4 @@<?php-use App\Http\Controllers\Auth\BlueskyController;-use App\Http\Controllers\Auth\FacebookController;-use App\Http\Controllers\Auth\InstagramController;-use App\Http\Controllers\Auth\LinkedInController;-use App\Http\Controllers\Auth\LinkedInPageController;-use App\Http\Controllers\Auth\MastodonController;-use App\Http\Controllers\Auth\PinterestController;-use App\Http\Controllers\Auth\SocialController;-use App\Http\Controllers\Auth\ThreadsController;-use App\Http\Controllers\Auth\TikTokController;-use App\Http\Controllers\Auth\XController;-use App\Http\Controllers\Auth\YouTubeController;-use App\Http\Controllers\BillingController;-use App\Http\Controllers\MediaController;-use App\Http\Controllers\OnboardingController;-use App\Http\Controllers\PostController;-use App\Http\Controllers\WorkspaceController;-use App\Http\Controllers\WorkspaceHashtagController;-use App\Http\Controllers\WorkspaceInviteController;-use App\Http\Controllers\WorkspaceLabelController;-use App\Http\Middleware\EnsureUserSetupIsComplete;-use Illuminate\Support\Facades\Route;--Route::get('/', function () {- return redirect()->route('calendar');-})->name('home')->middleware(['auth', 'verified']);--// Subscription selection (requires auth but not subscription)-Route::middleware(['auth', 'verified'])->group(function () {- Route::get('subscribe', [BillingController::class, 'subscribe'])->name('subscribe');- Route::post('billing/checkout', [BillingController::class, 'checkout'])->name('billing.checkout');- Route::get('billing/processing', [BillingController::class, 'processing'])->name('billing.processing');-});--// Onboarding routes (requires auth but not subscription or setup complete)-Route::middleware(['auth', 'verified'])->prefix('onboarding')->group(function () {- Route::get('step1', [OnboardingController::class, 'step1'])->name('onboarding.step1');- Route::post('step1', [OnboardingController::class, 'storeStep1'])->name('onboarding.step1.store');- Route::get('step2', [OnboardingController::class, 'step2'])->name('onboarding.step2');- Route::post('step2', [OnboardingController::class, 'storeStep2'])->name('onboarding.step2.store');- Route::get('complete', [OnboardingController::class, 'complete'])->name('onboarding.complete');-});--// Social Connect routes (requires auth but not subscription - needed for onboarding)-Route::middleware(['auth', 'verified'])->group(function () {- Route::get('connect/linkedin', [LinkedInController::class, 'connect'])->name('social.linkedin.connect');- Route::get('accounts/linkedin/callback', [LinkedInController::class, 'callback'])->name('social.linkedin.callback');-- Route::get('connect/linkedin-page', [LinkedInPageController::class, 'connect'])->name('social.linkedin-page.connect');- Route::get('accounts/linkedin-page/callback', [LinkedInPageController::class, 'callback'])->name('social.linkedin-page.callback');- Route::get('accounts/linkedin-page/select', [LinkedInPageController::class, 'selectPage'])->name('social.linkedin-page.select-page');- Route::post('accounts/linkedin-page/select', [LinkedInPageController::class, 'select'])->name('social.linkedin-page.select');-- Route::get('connect/x', [XController::class, 'connect'])->name('social.x.connect');- Route::get('accounts/x/callback', [XController::class, 'callback'])->name('social.x.callback');-- Route::get('connect/tiktok', [TikTokController::class, 'connect'])->name('social.tiktok.connect');- Route::get('accounts/tiktok/callback', [TikTokController::class, 'callback'])->name('social.tiktok.callback');-- Route::get('connect/youtube', [YouTubeController::class, 'connect'])->name('social.youtube.connect');- Route::get('accounts/youtube/callback', [YouTubeController::class, 'callback'])->name('social.youtube.callback');- Route::get('accounts/youtube/select', [YouTubeController::class, 'selectChannel'])->name('social.youtube.select-channel');- Route::post('accounts/youtube/select', [YouTubeController::class, 'select'])->name('social.youtube.select');-- Route::get('connect/facebook', [FacebookController::class, 'connect'])->name('social.facebook.connect');- Route::get('accounts/facebook/callback', [FacebookController::class, 'callback'])->name('social.facebook.callback');- Route::get('accounts/facebook/select', [FacebookController::class, 'selectPage'])->name('social.facebook.select-page');- Route::post('accounts/facebook/select', [FacebookController::class, 'select'])->name('social.facebook.select');-- Route::get('connect/instagram', [InstagramController::class, 'connect'])->name('social.instagram.connect');- Route::get('accounts/instagram/callback', [InstagramController::class, 'callback'])->name('social.instagram.callback');- Route::get('accounts/instagram/select', [InstagramController::class, 'selectAccount'])->name('social.instagram.select-account');- Route::post('accounts/instagram/select', [InstagramController::class, 'select'])->name('social.instagram.select');-- Route::get('connect/threads', [ThreadsController::class, 'connect'])->name('social.threads.connect');- Route::get('accounts/threads/callback', [ThreadsController::class, 'callback'])->name('social.threads.callback');-- Route::get('connect/pinterest', [PinterestController::class, 'connect'])->name('social.pinterest.connect');- Route::get('accounts/pinterest/callback', [PinterestController::class, 'callback'])->name('social.pinterest.callback');-- Route::get('connect/bluesky', [BlueskyController::class, 'connect'])->name('social.bluesky.connect');- Route::post('connect/bluesky', [BlueskyController::class, 'store'])->name('social.bluesky.store');-- Route::get('connect/mastodon', [MastodonController::class, 'connect'])->name('social.mastodon.connect');- Route::post('connect/mastodon', [MastodonController::class, 'authorizeInstance'])->name('social.mastodon.authorize');- Route::get('accounts/mastodon/callback', [MastodonController::class, 'callback'])->name('social.mastodon.callback');-});--// Routes that require active subscription and completed onboarding-Route::middleware(['auth', 'verified', 'subscribed', EnsureUserSetupIsComplete::class])->group(function () {- // Workspaces management- Route::get('workspaces', [WorkspaceController::class, 'index'])->name('workspaces.index');- Route::get('workspaces/create', [WorkspaceController::class, 'create'])->name('workspaces.create');- Route::post('workspaces', [WorkspaceController::class, 'store'])->name('workspaces.store');- Route::post('workspaces/{workspace}/switch', [WorkspaceController::class, 'switch'])->name('workspaces.switch');- Route::delete('workspaces/{workspace}', [WorkspaceController::class, 'destroy'])->name('workspaces.destroy');-- // Current workspace settings- Route::get('settings/workspace', [WorkspaceController::class, 'settings'])->name('workspace.settings');- Route::put('settings/workspace', [WorkspaceController::class, 'updateSettings'])->name('workspace.settings.update');-- // Social Accounts- Route::get('accounts', [SocialController::class, 'index'])->name('accounts');- Route::delete('accounts/{account}', [SocialController::class, 'disconnect'])->name('accounts.disconnect');-- // Calendar- Route::get('calendar', [PostController::class, 'calendar'])->name('calendar');-- // Posts- Route::get('posts/{status?}', [PostController::class, 'index'])->name('posts.index')->where('status', 'draft|scheduled|published');- Route::post('posts', [PostController::class, 'store'])->name('posts.store');- Route::get('posts/{post}/edit', [PostController::class, 'edit'])->name('posts.edit');- Route::put('posts/{post}', [PostController::class, 'update'])->name('posts.update');- Route::delete('posts/{post}', [PostController::class, 'destroy'])->name('posts.destroy');-- // Media- Route::post('medias', [MediaController::class, 'store'])->name('medias.store');- Route::post('medias/chunked', [MediaController::class, 'storeChunked'])->name('medias.store-chunked');- Route::post('medias/reorder', [MediaController::class, 'reorder'])->name('medias.reorder');- Route::post('medias/{media}/duplicate', [MediaController::class, 'duplicate'])->name('medias.duplicate');- Route::delete('medias/{modelId}/{media}', [MediaController::class, 'destroy'])->name('medias.destroy');-- // Members (Settings)- Route::get('settings/members', [WorkspaceInviteController::class, 'index'])->name('members');- Route::post('settings/members/invites', [WorkspaceInviteController::class, 'store'])->name('invites.store');- Route::delete('settings/members/invites/{invite}', [WorkspaceInviteController::class, 'destroy'])->name('invites.destroy');- Route::delete('settings/members/{user}', [WorkspaceInviteController::class, 'removeMember'])->name('members.remove');-- // Hashtags- Route::get('hashtags', [WorkspaceHashtagController::class, 'index'])->name('hashtags.index');- Route::post('hashtags', [WorkspaceHashtagController::class, 'store'])->name('hashtags.store');- Route::put('hashtags/{hashtag}', [WorkspaceHashtagController::class, 'update'])->name('hashtags.update');- Route::delete('hashtags/{hashtag}', [WorkspaceHashtagController::class, 'destroy'])->name('hashtags.destroy');-- // Labels- Route::get('labels', [WorkspaceLabelController::class, 'index'])->name('labels.index');- Route::post('labels', [WorkspaceLabelController::class, 'store'])->name('labels.store');- Route::put('labels/{label}', [WorkspaceLabelController::class, 'update'])->name('labels.update');- Route::delete('labels/{label}', [WorkspaceLabelController::class, 'destroy'])->name('labels.destroy');-- // Billing (under settings prefix)- Route::get('settings/billing', [BillingController::class, 'index'])->name('billing.index');- Route::get('settings/billing/portal', [BillingController::class, 'portal'])->name('billing.portal');-});--require __DIR__.'/settings.php';+require __DIR__.'/auth.php';+require __DIR__.'/app.php';diff --git a/tests/Feature/AcceptInviteControllerTest.php b/tests/Feature/AcceptInviteControllerTest.phpindex ce9d5dfce..66e1c491a 100644--- a/tests/Feature/AcceptInviteControllerTest.php+++ b/tests/Feature/AcceptInviteControllerTest.php@@ -20,7 +20,7 @@ test('show invite displays invite details for guest', function () {'role' => WorkspaceRole::Member,]);- $response = $this->get(route('invites.show', $invite));+ $response = $this->get(route('app.invites.show', $invite));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -45,7 +45,7 @@ test('show invite displays invite details for authenticated user', function () {'role' => WorkspaceRole::Member,]);- $response = $this->actingAs($user)->get(route('invites.show', $invite));+ $response = $this->actingAs($user)->get(route('app.invites.show', $invite));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -55,7 +55,7 @@ test('show invite displays invite details for authenticated user', function () {});test('show invite returns 404 for non-existent invite', function () {- $response = $this->get(route('invites.show', 'non-existent-uuid'));+ $response = $this->get(route('app.invites.show', 'non-existent-uuid'));$response->assertNotFound();});@@ -65,7 +65,7 @@ test('accept invite requires authentication', function () {'workspace_id' => $this->workspace->id,]);- $response = $this->post(route('invites.accept', $invite));+ $response = $this->post(route('app.invites.accept', $invite));$response->assertRedirect(route('login'));});@@ -82,9 +82,9 @@ test('accept invite adds user to workspace', function () {'role' => WorkspaceRole::Admin,]);- $response = $this->actingAs($user)->post(route('invites.accept', $invite));+ $response = $this->actingAs($user)->post(route('app.invites.accept', $invite));- $response->assertRedirect(route('calendar'));+ $response->assertRedirect(route('app.calendar'));// User should be member of workspaceexpect($this->workspace->hasMember($user))->toBeTrue();@@ -109,9 +109,9 @@ test('accept invite fails for wrong email', function () {'role' => WorkspaceRole::Member,]);- $response = $this->actingAs($user)->post(route('invites.accept', $invite));+ $response = $this->actingAs($user)->post(route('app.invites.accept', $invite));- $response->assertRedirect(route('calendar'));+ $response->assertRedirect(route('app.calendar'));$response->assertSessionHas('flash.bannerStyle', 'danger');// Invite should NOT be deleted@@ -132,9 +132,9 @@ test('accept invite handles already member', function () {'role' => WorkspaceRole::Admin,]);- $response = $this->actingAs($user)->post(route('invites.accept', $invite));+ $response = $this->actingAs($user)->post(route('app.invites.accept', $invite));- $response->assertRedirect(route('calendar'));+ $response->assertRedirect(route('app.calendar'));$response->assertSessionHas('flash.bannerStyle', 'info');// Invite should be deleted@@ -146,7 +146,7 @@ test('decline invite requires authentication', function () {'workspace_id' => $this->workspace->id,]);- $response = $this->post(route('invites.decline', $invite));+ $response = $this->post(route('app.invites.decline', $invite));$response->assertRedirect(route('login'));});@@ -163,9 +163,9 @@ test('decline invite deletes the invite', function () {'role' => WorkspaceRole::Member,]);- $response = $this->actingAs($user)->post(route('invites.decline', $invite));+ $response = $this->actingAs($user)->post(route('app.invites.decline', $invite));- $response->assertRedirect(route('calendar'));+ $response->assertRedirect(route('app.calendar'));$response->assertSessionHas('flash.bannerStyle', 'info');// Invite should be deleted@@ -187,9 +187,9 @@ test('decline invite fails for wrong email', function () {'role' => WorkspaceRole::Member,]);- $response = $this->actingAs($user)->post(route('invites.decline', $invite));+ $response = $this->actingAs($user)->post(route('app.invites.decline', $invite));- $response->assertRedirect(route('calendar'));+ $response->assertRedirect(route('app.calendar'));$response->assertSessionHas('flash.bannerStyle', 'danger');// Invite should NOT be deleteddiff --git a/tests/Feature/Auth/AuthenticationTest.php b/tests/Feature/Auth/AuthenticationTest.phpindex 17a0bfb5f..770d6062d 100644--- a/tests/Feature/Auth/AuthenticationTest.php+++ b/tests/Feature/Auth/AuthenticationTest.php@@ -19,7 +19,7 @@ test('users can authenticate using the login screen', function () {]);$this->assertAuthenticated();- $response->assertRedirect(route('calendar', absolute: false));+ $response->assertRedirect(route('app.calendar', absolute: false));});test('users can not authenticate with invalid password', function () {diff --git a/tests/Feature/Auth/EmailVerificationTest.php b/tests/Feature/Auth/EmailVerificationTest.phpindex eff011950..1abc32c97 100644--- a/tests/Feature/Auth/EmailVerificationTest.php+++ b/tests/Feature/Auth/EmailVerificationTest.php@@ -28,7 +28,7 @@ test('email can be verified', function () {Event::assertDispatched(Verified::class);expect($user->fresh()->hasVerifiedEmail())->toBeTrue();- $response->assertRedirect(route('calendar', absolute: false).'?verified=1');+ $response->assertRedirect(route('app.calendar', absolute: false).'?verified=1');});test('email is not verified with invalid hash', function () {@@ -73,7 +73,7 @@ test('verified user is redirected to dashboard from verification prompt', functi$response = $this->actingAs($user)->get(route('verification.notice'));Event::assertNotDispatched(Verified::class);- $response->assertRedirect(route('calendar', absolute: false));+ $response->assertRedirect(route('app.calendar', absolute: false));});test('already verified user visiting verification link is redirected without firing event again', function () {@@ -88,7 +88,7 @@ test('already verified user visiting verification link is redirected without fir);$this->actingAs($user)->get($verificationUrl)- ->assertRedirect(route('calendar', absolute: false).'?verified=1');+ ->assertRedirect(route('app.calendar', absolute: false).'?verified=1');Event::assertNotDispatched(Verified::class);expect($user->fresh()->hasVerifiedEmail())->toBeTrue();diff --git a/tests/Feature/Auth/RegistrationTest.php b/tests/Feature/Auth/RegistrationTest.phpindex 3a5924e1b..1ea651284 100644--- a/tests/Feature/Auth/RegistrationTest.php+++ b/tests/Feature/Auth/RegistrationTest.php@@ -17,7 +17,7 @@ test('new users can register', function () {$response->assertSessionHasNoErrors();$this->assertAuthenticated();- $response->assertRedirect(route('onboarding.step1', absolute: false));+ $response->assertRedirect(route('app.onboarding.step1', absolute: false));});test('new users get a default workspace on registration', function () {diff --git a/tests/Feature/Auth/VerificationNotificationTest.php b/tests/Feature/Auth/VerificationNotificationTest.phpindex 81bdd287b..adec9f6bc 100644--- a/tests/Feature/Auth/VerificationNotificationTest.php+++ b/tests/Feature/Auth/VerificationNotificationTest.php@@ -11,7 +11,7 @@ test('sends verification notification', function () {$this->actingAs($user)->post(route('verification.send'))- ->assertRedirect(route('home'));+ ->assertRedirect(route('app.home'));Notification::assertSentTo($user, VerifyEmail::class);});@@ -23,7 +23,7 @@ test('does not send verification notification if email is verified', function ()$this->actingAs($user)->post(route('verification.send'))- ->assertRedirect(route('calendar', absolute: false));+ ->assertRedirect(route('app.calendar', absolute: false));Notification::assertNothingSent();});diff --git a/tests/Feature/BillingControllerTest.php b/tests/Feature/BillingControllerTest.phpindex 13bdc8f37..2ed7ed5ce 100644--- a/tests/Feature/BillingControllerTest.php+++ b/tests/Feature/BillingControllerTest.php@@ -12,13 +12,13 @@ beforeEach(function () {// Subscribe teststest('subscribe requires authentication', function () {- $response = $this->get(route('subscribe'));+ $response = $this->get(route('app.subscribe'));$response->assertRedirect(route('login'));});test('subscribe shows subscription page', function () {- $response = $this->actingAs($this->user)->get(route('subscribe'));+ $response = $this->actingAs($this->user)->get(route('app.subscribe'));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -29,13 +29,13 @@ test('subscribe shows subscription page', function () {// Index teststest('billing index requires authentication', function () {- $response = $this->get(route('billing.index'));+ $response = $this->get(route('app.billing.index'));$response->assertRedirect(route('login'));});test('billing index shows billing dashboard', function () {- $response = $this->actingAs($this->user)->get(route('billing.index'));+ $response = $this->actingAs($this->user)->get(route('app.billing.index'));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -47,13 +47,13 @@ test('billing index shows billing dashboard', function () {// Processing teststest('billing processing requires authentication', function () {- $response = $this->get(route('billing.processing'));+ $response = $this->get(route('app.billing.processing'));$response->assertRedirect(route('login'));});test('billing processing shows processing page', function () {- $response = $this->actingAs($this->user)->get(route('billing.processing'));+ $response = $this->actingAs($this->user)->get(route('app.billing.processing'));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -64,7 +64,7 @@ test('billing processing shows processing page', function () {});test('billing processing accepts status parameter', function () {- $response = $this->actingAs($this->user)->get(route('billing.processing', ['status' => 'success']));+ $response = $this->actingAs($this->user)->get(route('app.billing.processing', ['status' => 'success']));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -73,7 +73,7 @@ test('billing processing accepts status parameter', function () {});test('billing processing validates status parameter', function () {- $response = $this->actingAs($this->user)->get(route('billing.processing', ['status' => 'invalid']));+ $response = $this->actingAs($this->user)->get(route('app.billing.processing', ['status' => 'invalid']));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -83,14 +83,14 @@ test('billing processing validates status parameter', function () {// Checkout teststest('checkout requires authentication', function () {- $response = $this->post(route('billing.checkout'));+ $response = $this->post(route('app.billing.checkout'));$response->assertRedirect(route('login'));});// Portal teststest('portal requires authentication', function () {- $response = $this->get(route('billing.portal'));+ $response = $this->get(route('app.billing.portal'));$response->assertRedirect(route('login'));});diff --git a/tests/Feature/Controllers/BillingControllerTest.php b/tests/Feature/Controllers/BillingControllerTest.phpindex 4bbeaa4be..758ff111e 100644--- a/tests/Feature/Controllers/BillingControllerTest.php+++ b/tests/Feature/Controllers/BillingControllerTest.php@@ -21,7 +21,7 @@ test('billing index shows subscription info for subscribed user', function () {'quantity' => 2,]);- $response = $this->actingAs($this->user)->get(route('billing.index'));+ $response = $this->actingAs($this->user)->get(route('app.billing.index'));$response->assertSuccessful();$response->assertInertia(fn ($page) => $page@@ -33,7 +33,7 @@ test('billing index shows subscription info for subscribed user', function () {});test('billing index shows info for user without subscription', function () {- $response = $this->actingAs($this->user)->get(route('billing.index'));+ $response = $this->actingAs($this->user)->get(route('app.billing.index'));$response->assertSuccessful();$response->assertInertia(fn ($page) => $page@@ -52,7 +52,7 @@ test('billing index shows trial info when on trial', function () {'trial_ends_at' => now()->addDays(14),]);- $response = $this->actingAs($this->user)->get(route('billing.index'));+ $response = $this->actingAs($this->user)->get(route('app.billing.index'));$response->assertSuccessful();$response->assertInertia(fn ($page) => $page@@ -63,7 +63,7 @@ test('billing index shows trial info when on trial', function () {});test('processing page shows for user during checkout', function () {- $response = $this->actingAs($this->user)->get(route('billing.processing', ['status' => 'success']));+ $response = $this->actingAs($this->user)->get(route('app.billing.processing', ['status' => 'success']));$response->assertSuccessful();$response->assertInertia(fn ($page) => $page@@ -74,7 +74,7 @@ test('processing page shows for user during checkout', function () {});test('processing page shows cancelled status', function () {- $response = $this->actingAs($this->user)->get(route('billing.processing', ['status' => 'cancelled']));+ $response = $this->actingAs($this->user)->get(route('app.billing.processing', ['status' => 'cancelled']));$response->assertSuccessful();$response->assertInertia(fn ($page) => $page@@ -83,7 +83,7 @@ test('processing page shows cancelled status', function () {});test('processing page defaults to processing status for invalid status', function () {- $response = $this->actingAs($this->user)->get(route('billing.processing', ['status' => 'invalid']));+ $response = $this->actingAs($this->user)->get(route('app.billing.processing', ['status' => 'invalid']));$response->assertSuccessful();$response->assertInertia(fn ($page) => $pagediff --git a/tests/Feature/Controllers/ChunkedUploadTest.php b/tests/Feature/Controllers/ChunkedUploadTest.phpindex 2de2deb11..ca7804cd9 100644--- a/tests/Feature/Controllers/ChunkedUploadTest.php+++ b/tests/Feature/Controllers/ChunkedUploadTest.php@@ -27,7 +27,7 @@ test('chunked upload completes with single chunk', function () {$response = $this->actingAs($this->user)->call('POST',- route('medias.store-chunked'),+ route('app.medias.store-chunked'),[],[],[],@@ -56,7 +56,7 @@ test('chunked upload reports progress on intermediate chunks', function () {$response = $this->actingAs($this->user)->call('POST',- route('medias.store-chunked'),+ route('app.medias.store-chunked'),[],[],[],@@ -88,7 +88,7 @@ test('chunked upload completes with multiple chunks', function () {// First chunk$this->actingAs($this->user)->call('POST',- route('medias.store-chunked'),+ route('app.medias.store-chunked'),[],[],[],@@ -107,7 +107,7 @@ test('chunked upload completes with multiple chunks', function () {// Second chunk (last)$response = $this->actingAs($this->user)->call('POST',- route('medias.store-chunked'),+ route('app.medias.store-chunked'),[],[],[],@@ -131,7 +131,7 @@ test('chunked upload completes with multiple chunks', function () {test('chunked upload fails without content range header', function () {$response = $this->actingAs($this->user)->call('POST',- route('medias.store-chunked'),+ route('app.medias.store-chunked'),[],[],[],@@ -152,7 +152,7 @@ test('chunked upload fails without content range header', function () {test('chunked upload fails with invalid model type', function () {$response = $this->actingAs($this->user)->call('POST',- route('medias.store-chunked'),+ route('app.medias.store-chunked'),[],[],[],@@ -174,7 +174,7 @@ test('chunked upload fails with invalid model type', function () {test('chunked upload fails without model header', function () {$response = $this->actingAs($this->user)->call('POST',- route('medias.store-chunked'),+ route('app.medias.store-chunked'),[],[],[],@@ -194,7 +194,7 @@ test('chunked upload fails without model header', function () {test('chunked upload fails without file name header', function () {$response = $this->actingAs($this->user)->call('POST',- route('medias.store-chunked'),+ route('app.medias.store-chunked'),[],[],[],@@ -219,7 +219,7 @@ test('chunked upload cleans up temp file after completion', function () {$this->actingAs($this->user)->call('POST',- route('medias.store-chunked'),+ route('app.medias.store-chunked'),[],[],[],diff --git a/tests/Feature/Controllers/MediaControllerTest.php b/tests/Feature/Controllers/MediaControllerTest.phpindex 2cea97af5..624b56ca7 100644--- a/tests/Feature/Controllers/MediaControllerTest.php+++ b/tests/Feature/Controllers/MediaControllerTest.php@@ -3,6 +3,7 @@use App\Enums\User\Setup;use App\Models\Media;use App\Models\PostPlatform;+use App\Models\SocialAccount;use App\Models\User;use App\Models\Workspace;use Illuminate\Http\UploadedFile;@@ -27,7 +28,7 @@ beforeEach(function () {test('user can upload media to workspace', function () {$file = UploadedFile::fake()->image('logo.jpg', 100, 100);- $response = $this->actingAs($this->user)->postJson(route('medias.store'), [+ $response = $this->actingAs($this->user)->postJson(route('app.medias.store'), ['media' => $file,'model' => 'workspace','model_id' => $this->workspace->id,@@ -43,7 +44,7 @@ test('user can delete media', function () {$file = UploadedFile::fake()->image('logo.jpg', 100, 100);$media = $this->workspace->addMedia($file, 'logo');- $response = $this->actingAs($this->user)->deleteJson(route('medias.destroy', [+ $response = $this->actingAs($this->user)->deleteJson(route('app.medias.destroy', ['modelId' => $this->workspace->id,'media' => $media->id,]));@@ -58,7 +59,7 @@ test('user cannot delete media from different model', function () {$otherWorkspace = Workspace::factory()->create();- $response = $this->actingAs($this->user)->deleteJson(route('medias.destroy', [+ $response = $this->actingAs($this->user)->deleteJson(route('app.medias.destroy', ['modelId' => $otherWorkspace->id,'media' => $media->id,]));@@ -71,12 +72,12 @@ test('user can duplicate media to another model', function () {$media = $this->workspace->addMedia($file, 'default');$postPlatform = PostPlatform::factory()->create([- 'social_account_id' => \App\Models\SocialAccount::factory()->linkedin()->create([+ 'social_account_id' => SocialAccount::factory()->linkedin()->create(['workspace_id' => $this->workspace->id,])->id,]);- $response = $this->actingAs($this->user)->postJson(route('medias.duplicate', ['media' => $media->id]), [+ $response = $this->actingAs($this->user)->postJson(route('app.medias.duplicate', ['media' => $media->id]), ['targets' => [['model' => 'postPlatform',@@ -93,7 +94,7 @@ test('user can duplicate media to another model', function () {test('media store fails with invalid model type', function () {$file = UploadedFile::fake()->image('logo.jpg', 100, 100);- $response = $this->actingAs($this->user)->postJson(route('medias.store'), [+ $response = $this->actingAs($this->user)->postJson(route('app.medias.store'), ['media' => $file,'model' => 'invalid','model_id' => $this->workspace->id,diff --git a/tests/Feature/Controllers/OnboardingControllerTest.php b/tests/Feature/Controllers/OnboardingControllerTest.phpindex b7df70665..ca7db7ed6 100644--- a/tests/Feature/Controllers/OnboardingControllerTest.php+++ b/tests/Feature/Controllers/OnboardingControllerTest.php@@ -12,7 +12,7 @@ beforeEach(function () {});test('step1 shows persona selection', function () {- $response = $this->actingAs($this->user)->get(route('onboarding.step1'));+ $response = $this->actingAs($this->user)->get(route('app.onboarding.step1'));$response->assertSuccessful();$response->assertInertia(fn ($page) => $page@@ -22,17 +22,17 @@ test('step1 shows persona selection', function () {});test('step1 can be stored with valid persona', function () {- $response = $this->actingAs($this->user)->post(route('onboarding.step1.store'), [+ $response = $this->actingAs($this->user)->post(route('app.onboarding.step1.store'), ['persona' => Persona::Creator->value,]);- $response->assertRedirect(route('onboarding.step2'));+ $response->assertRedirect(route('app.onboarding.step2'));expect($this->user->fresh()->persona)->toBe(Persona::Creator);expect($this->user->fresh()->setup)->toBe(Setup::Connections);});test('step1 fails with invalid persona', function () {- $response = $this->actingAs($this->user)->post(route('onboarding.step1.store'), [+ $response = $this->actingAs($this->user)->post(route('app.onboarding.step1.store'), ['persona' => 'invalid',]);@@ -44,7 +44,7 @@ test('step2 shows platforms page', function () {$workspace = Workspace::factory()->create(['user_id' => $this->user->id]);$this->user->update(['current_workspace_id' => $workspace->id]);- $response = $this->actingAs($this->user)->get(route('onboarding.step2'));+ $response = $this->actingAs($this->user)->get(route('app.onboarding.step2'));$response->assertSuccessful();$response->assertInertia(fn ($page) => $page@@ -57,7 +57,7 @@ test('step2 shows platforms page', function () {test('step2 shows without workspace', function () {$this->user->update(['setup' => Setup::Connections]);- $response = $this->actingAs($this->user)->get(route('onboarding.step2'));+ $response = $this->actingAs($this->user)->get(route('app.onboarding.step2'));$response->assertSuccessful();$response->assertInertia(fn ($page) => $page@@ -69,17 +69,17 @@ test('step2 store redirects to calendar in self hosted mode', function () {config(['trypost.self_hosted' => true]);$this->user->update(['setup' => Setup::Connections]);- $response = $this->actingAs($this->user)->post(route('onboarding.step2.store'));+ $response = $this->actingAs($this->user)->post(route('app.onboarding.step2.store'));- $response->assertRedirect(route('calendar'));+ $response->assertRedirect(route('app.calendar'));expect($this->user->fresh()->setup)->toBe(Setup::Completed);});test('complete sets setup to completed', function () {$this->user->update(['setup' => Setup::Subscription]);- $response = $this->actingAs($this->user)->get(route('onboarding.complete'));+ $response = $this->actingAs($this->user)->get(route('app.onboarding.complete'));- $response->assertRedirect(route('calendar'));+ $response->assertRedirect(route('app.calendar'));expect($this->user->fresh()->setup)->toBe(Setup::Completed);});diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.phpindex eb11b08f7..0c41590f1 100644--- a/tests/Feature/ExampleTest.php+++ b/tests/Feature/ExampleTest.php@@ -3,7 +3,7 @@use App\Models\User;test('home redirects to login for guests', function () {- $response = $this->get(route('home'));+ $response = $this->get(route('app.home'));$response->assertRedirect(route('login'));});@@ -11,7 +11,7 @@ test('home redirects to login for guests', function () {test('home redirects to calendar for authenticated users', function () {$user = User::factory()->create();- $response = $this->actingAs($user)->get(route('home'));+ $response = $this->actingAs($user)->get(route('app.home'));- $response->assertRedirect(route('calendar'));+ $response->assertRedirect(route('app.calendar'));});diff --git a/tests/Feature/Jobs/PublishToSocialPlatformTest.php b/tests/Feature/Jobs/PublishToSocialPlatformTest.phpindex 0a11383c5..574fb62a1 100644--- a/tests/Feature/Jobs/PublishToSocialPlatformTest.php+++ b/tests/Feature/Jobs/PublishToSocialPlatformTest.php@@ -70,7 +70,7 @@ test('publish to social platform marks platform as failed on error', function ()Event::fake();$publisher = Mockery::mock(LinkedInPublisher::class);- $publisher->shouldReceive('publish')->andThrow(new \Exception('API Error'));+ $publisher->shouldReceive('publish')->andThrow(new Exception('API Error'));$this->app->instance(LinkedInPublisher::class, $publisher);@@ -147,7 +147,7 @@ test('publish to social platform marks post as failed when all platforms fail',Event::fake();$publisher = Mockery::mock(LinkedInPublisher::class);- $publisher->shouldReceive('publish')->andThrow(new \Exception('API Error'));+ $publisher->shouldReceive('publish')->andThrow(new Exception('API Error'));$this->app->instance(LinkedInPublisher::class, $publisher);diff --git a/tests/Feature/MediaControllerTest.php b/tests/Feature/MediaControllerTest.phpindex 2ef3fd926..c8a0e19be 100644--- a/tests/Feature/MediaControllerTest.php+++ b/tests/Feature/MediaControllerTest.php@@ -29,7 +29,7 @@ beforeEach(function () {// Store teststest('store media requires authentication', function () {- $response = $this->post(route('medias.store'), [+ $response = $this->post(route('app.medias.store'), ['model' => 'postPlatform','model_id' => $this->postPlatform->id,'media' => UploadedFile::fake()->image('test.jpg'),@@ -39,7 +39,7 @@ test('store media requires authentication', function () {});test('store media uploads file', function () {- $response = $this->actingAs($this->user)->post(route('medias.store'), [+ $response = $this->actingAs($this->user)->post(route('app.medias.store'), ['model' => 'postPlatform','model_id' => $this->postPlatform->id,'media' => UploadedFile::fake()->image('test.jpg'),@@ -50,7 +50,7 @@ test('store media uploads file', function () {});test('store media validates required fields', function () {- $response = $this->actingAs($this->user)->post(route('medias.store'), [+ $response = $this->actingAs($this->user)->post(route('app.medias.store'), ['model' => '','model_id' => '',]);@@ -65,7 +65,7 @@ test('destroy media requires authentication', function () {'mediable_type' => 'postPlatform',]);- $response = $this->delete(route('medias.destroy', [$this->postPlatform->id, $media]));+ $response = $this->delete(route('app.medias.destroy', [$this->postPlatform->id, $media]));$response->assertRedirect(route('login'));});@@ -76,7 +76,7 @@ test('destroy media deletes the media', function () {'mediable_type' => 'postPlatform',]);- $response = $this->actingAs($this->user)->delete(route('medias.destroy', [$this->postPlatform->id, $media]));+ $response = $this->actingAs($this->user)->delete(route('app.medias.destroy', [$this->postPlatform->id, $media]));$response->assertOk();$response->assertJson(['success' => true]);@@ -94,7 +94,7 @@ test('destroy media returns 403 for mismatched model', function () {'mediable_type' => 'postPlatform',]);- $response = $this->actingAs($this->user)->delete(route('medias.destroy', [$this->postPlatform->id, $media]));+ $response = $this->actingAs($this->user)->delete(route('app.medias.destroy', [$this->postPlatform->id, $media]));$response->assertForbidden();});@@ -106,7 +106,7 @@ test('duplicate media requires authentication', function () {'mediable_type' => 'postPlatform',]);- $response = $this->post(route('medias.duplicate', $media), [+ $response = $this->post(route('app.medias.duplicate', $media), ['targets' => [],]);@@ -124,7 +124,7 @@ test('duplicate media creates copies', function () {'social_account_id' => $this->socialAccount->id,]);- $response = $this->actingAs($this->user)->post(route('medias.duplicate', $media), [+ $response = $this->actingAs($this->user)->post(route('app.medias.duplicate', $media), ['targets' => [['model' => 'postPlatform',diff --git a/tests/Feature/Middleware/EnsureSubscribedTest.php b/tests/Feature/Middleware/EnsureSubscribedTest.phpindex 89f3a8b66..042cb6cdb 100644--- a/tests/Feature/Middleware/EnsureSubscribedTest.php+++ b/tests/Feature/Middleware/EnsureSubscribedTest.php@@ -13,14 +13,14 @@ test('self hosted mode bypasses subscription check', function () {$user->update(['current_workspace_id' => $workspace->id]);$this->actingAs($user)- ->get(route('calendar'))+ ->get(route('app.calendar'))->assertOk();});test('unauthenticated user is redirected to login', function () {config(['trypost.self_hosted' => false]);- $this->get(route('calendar'))+ $this->get(route('app.calendar'))->assertRedirect(route('login'));});@@ -40,7 +40,7 @@ test('user with active subscription can access protected route', function () {]);$this->actingAs($user)- ->get(route('calendar'))+ ->get(route('app.calendar'))->assertOk();});@@ -62,7 +62,7 @@ test('user on trial subscription can access protected route', function () {]);$this->actingAs($user)- ->get(route('calendar'))+ ->get(route('app.calendar'))->assertOk();});@@ -75,8 +75,8 @@ test('user without subscription is redirected to subscribe page', function () {$user->update(['current_workspace_id' => $workspace->id]);$this->actingAs($user)- ->get(route('calendar'))- ->assertRedirect(route('subscribe'));+ ->get(route('app.calendar'))+ ->assertRedirect(route('app.subscribe'));});test('user with expired trial subscription is redirected to subscribe page', function () {@@ -98,8 +98,8 @@ test('user with expired trial subscription is redirected to subscribe page', fun]);$this->actingAs($user)- ->get(route('calendar'))- ->assertRedirect(route('subscribe'));+ ->get(route('app.calendar'))+ ->assertRedirect(route('app.subscribe'));});test('user with cancelled subscription is redirected to subscribe page', function () {@@ -119,8 +119,8 @@ test('user with cancelled subscription is redirected to subscribe page', functio]);$this->actingAs($user)- ->get(route('calendar'))- ->assertRedirect(route('subscribe'));+ ->get(route('app.calendar'))+ ->assertRedirect(route('app.subscribe'));});test('invited member can access workspace when owner has active subscription', function () {@@ -142,7 +142,7 @@ test('invited member can access workspace when owner has active subscription', f$member->update(['current_workspace_id' => $workspace->id]);$this->actingAs($member)- ->get(route('calendar'))+ ->get(route('app.calendar'))->assertOk();});@@ -158,8 +158,8 @@ test('invited member is redirected to subscribe when owner has no subscription',$member->update(['current_workspace_id' => $workspace->id]);$this->actingAs($member)- ->get(route('calendar'))- ->assertRedirect(route('subscribe'));+ ->get(route('app.calendar'))+ ->assertRedirect(route('app.subscribe'));});test('invited member on own workspace without subscription is redirected to subscribe', function () {@@ -184,6 +184,6 @@ test('invited member on own workspace without subscription is redirected to subs$member->update(['current_workspace_id' => $memberWorkspace->id]);$this->actingAs($member)- ->get(route('calendar'))- ->assertRedirect(route('subscribe'));+ ->get(route('app.calendar'))+ ->assertRedirect(route('app.subscribe'));});diff --git a/tests/Feature/Middleware/EnsureUserSetupIsCompleteTest.php b/tests/Feature/Middleware/EnsureUserSetupIsCompleteTest.phpindex 1e61c33c1..d5e022aa3 100644--- a/tests/Feature/Middleware/EnsureUserSetupIsCompleteTest.php+++ b/tests/Feature/Middleware/EnsureUserSetupIsCompleteTest.php@@ -13,7 +13,7 @@ test('user with completed setup can access protected routes', function () {$user->update(['current_workspace_id' => $workspace->id]);$this->actingAs($user)- ->get(route('calendar'))+ ->get(route('app.calendar'))->assertOk();});@@ -26,8 +26,8 @@ test('user on role step is redirected to onboarding step 1', function () {$user->update(['current_workspace_id' => $workspace->id]);$this->actingAs($user)- ->get(route('calendar'))- ->assertRedirect(route('onboarding.step1'));+ ->get(route('app.calendar'))+ ->assertRedirect(route('app.onboarding.step1'));});test('user on connections step is redirected to onboarding step 2', function () {@@ -39,8 +39,8 @@ test('user on connections step is redirected to onboarding step 2', function ()$user->update(['current_workspace_id' => $workspace->id]);$this->actingAs($user)- ->get(route('calendar'))- ->assertRedirect(route('onboarding.step2'));+ ->get(route('app.calendar'))+ ->assertRedirect(route('app.onboarding.step2'));});test('user on subscription step is redirected to onboarding step 2', function () {@@ -52,15 +52,15 @@ test('user on subscription step is redirected to onboarding step 2', function ()$user->update(['current_workspace_id' => $workspace->id]);$this->actingAs($user)- ->get(route('calendar'))- ->assertRedirect(route('onboarding.step2'));+ ->get(route('app.calendar'))+ ->assertRedirect(route('app.onboarding.step2'));});test('user on role step can access onboarding step 1', function () {$user = User::factory()->create(['setup' => Setup::Role]);$this->actingAs($user)- ->get(route('onboarding.step1'))+ ->get(route('app.onboarding.step1'))->assertOk();});@@ -68,7 +68,7 @@ test('user on connections step can access onboarding step 2', function () {$user = User::factory()->create(['setup' => Setup::Connections]);$this->actingAs($user)- ->get(route('onboarding.step2'))+ ->get(route('app.onboarding.step2'))->assertOk();});@@ -76,6 +76,6 @@ test('user on connections step can access social connect routes', function () {$user = User::factory()->create(['setup' => Setup::Connections]);$this->actingAs($user)- ->get(route('social.linkedin.connect'))+ ->get(route('app.social.linkedin.connect'))->assertRedirect();});diff --git a/tests/Feature/OnboardingControllerTest.php b/tests/Feature/OnboardingControllerTest.phpindex 19653bcb9..5f5053a60 100644--- a/tests/Feature/OnboardingControllerTest.php+++ b/tests/Feature/OnboardingControllerTest.php@@ -13,13 +13,13 @@ beforeEach(function () {// Step 1 teststest('step1 requires authentication', function () {- $response = $this->get(route('onboarding.step1'));+ $response = $this->get(route('app.onboarding.step1'));$response->assertRedirect(route('login'));});test('step1 shows persona selection', function () {- $response = $this->actingAs($this->user)->get(route('onboarding.step1'));+ $response = $this->actingAs($this->user)->get(route('app.onboarding.step1'));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -30,7 +30,7 @@ test('step1 shows persona selection', function () {// Store Step 1 teststest('store step1 requires authentication', function () {- $response = $this->post(route('onboarding.step1.store'), [+ $response = $this->post(route('app.onboarding.step1.store'), ['persona' => Persona::Founder->value,]);@@ -38,11 +38,11 @@ test('store step1 requires authentication', function () {});test('store step1 saves persona and redirects to step2', function () {- $response = $this->actingAs($this->user)->post(route('onboarding.step1.store'), [+ $response = $this->actingAs($this->user)->post(route('app.onboarding.step1.store'), ['persona' => Persona::Founder->value,]);- $response->assertRedirect(route('onboarding.step2'));+ $response->assertRedirect(route('app.onboarding.step2'));$this->user->refresh();expect($this->user->persona)->toBe(Persona::Founder);@@ -50,7 +50,7 @@ test('store step1 saves persona and redirects to step2', function () {});test('store step1 validates persona is required', function () {- $response = $this->actingAs($this->user)->post(route('onboarding.step1.store'), [+ $response = $this->actingAs($this->user)->post(route('app.onboarding.step1.store'), ['persona' => '',]);@@ -58,7 +58,7 @@ test('store step1 validates persona is required', function () {});test('store step1 validates persona is valid enum', function () {- $response = $this->actingAs($this->user)->post(route('onboarding.step1.store'), [+ $response = $this->actingAs($this->user)->post(route('app.onboarding.step1.store'), ['persona' => 'invalid',]);@@ -67,7 +67,7 @@ test('store step1 validates persona is valid enum', function () {// Step 2 teststest('step2 requires authentication', function () {- $response = $this->get(route('onboarding.step2'));+ $response = $this->get(route('app.onboarding.step2'));$response->assertRedirect(route('login'));});@@ -75,7 +75,7 @@ test('step2 requires authentication', function () {test('step2 shows social accounts connection', function () {$this->user->update(['setup' => Setup::Connections]);- $response = $this->actingAs($this->user)->get(route('onboarding.step2'));+ $response = $this->actingAs($this->user)->get(route('app.onboarding.step2'));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -95,7 +95,7 @@ test('step2 shows connected accounts for workspace', function () {'platform' => Platform::LinkedIn,]);- $response = $this->actingAs($this->user)->get(route('onboarding.step2'));+ $response = $this->actingAs($this->user)->get(route('app.onboarding.step2'));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -105,7 +105,7 @@ test('step2 shows connected accounts for workspace', function () {// Store Step 2 teststest('store step2 requires authentication', function () {- $response = $this->post(route('onboarding.step2.store'));+ $response = $this->post(route('app.onboarding.step2.store'));$response->assertRedirect(route('login'));});@@ -114,9 +114,9 @@ test('store step2 completes setup in self-hosted mode', function () {config(['trypost.self_hosted' => true]);$this->user->update(['setup' => Setup::Connections]);- $response = $this->actingAs($this->user)->post(route('onboarding.step2.store'));+ $response = $this->actingAs($this->user)->post(route('app.onboarding.step2.store'));- $response->assertRedirect(route('calendar'));+ $response->assertRedirect(route('app.calendar'));$this->user->refresh();expect($this->user->setup)->toBe(Setup::Completed);@@ -124,7 +124,7 @@ test('store step2 completes setup in self-hosted mode', function () {// Complete teststest('complete requires authentication', function () {- $response = $this->get(route('onboarding.complete'));+ $response = $this->get(route('app.onboarding.complete'));$response->assertRedirect(route('login'));});@@ -132,9 +132,9 @@ test('complete requires authentication', function () {test('complete marks setup as completed', function () {$this->user->update(['setup' => Setup::Subscription]);- $response = $this->actingAs($this->user)->get(route('onboarding.complete'));+ $response = $this->actingAs($this->user)->get(route('app.onboarding.complete'));- $response->assertRedirect(route('calendar'));+ $response->assertRedirect(route('app.calendar'));$this->user->refresh();expect($this->user->setup)->toBe(Setup::Completed);diff --git a/tests/Feature/PostControllerTest.php b/tests/Feature/PostControllerTest.phpindex 1bd904112..7257f4706 100644--- a/tests/Feature/PostControllerTest.php+++ b/tests/Feature/PostControllerTest.php@@ -24,7 +24,7 @@ beforeEach(function () {// Index teststest('posts index requires authentication', function () {- $response = $this->get(route('posts.index'));+ $response = $this->get(route('app.posts.index'));$response->assertRedirect(route('login'));});@@ -35,7 +35,7 @@ test('posts index shows posts for current workspace', function () {'user_id' => $this->user->id,]);- $response = $this->actingAs($this->user)->get(route('posts.index'));+ $response = $this->actingAs($this->user)->get(route('app.posts.index'));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -47,20 +47,20 @@ test('posts index shows posts for current workspace', function () {test('posts index redirects to create workspace if no workspace', function () {$this->user->update(['current_workspace_id' => null]);- $response = $this->actingAs($this->user)->get(route('posts.index'));+ $response = $this->actingAs($this->user)->get(route('app.posts.index'));- $response->assertRedirect(route('workspaces.create'));+ $response->assertRedirect(route('app.workspaces.create'));});// Calendar teststest('calendar requires authentication', function () {- $response = $this->get(route('calendar'));+ $response = $this->get(route('app.calendar'));$response->assertRedirect(route('login'));});test('calendar shows posts for current week', function () {- $response = $this->actingAs($this->user)->get(route('calendar'));+ $response = $this->actingAs($this->user)->get(route('app.calendar'));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -73,7 +73,7 @@ test('calendar shows posts for current week', function () {});test('calendar supports month view', function () {- $response = $this->actingAs($this->user)->get(route('calendar', ['view' => 'month']));+ $response = $this->actingAs($this->user)->get(route('app.calendar', ['view' => 'month']));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -83,7 +83,7 @@ test('calendar supports month view', function () {// Store teststest('store post requires authentication', function () {- $response = $this->post(route('posts.store'));+ $response = $this->post(route('app.posts.store'));$response->assertRedirect(route('login'));});@@ -91,13 +91,13 @@ test('store post requires authentication', function () {test('store post redirects to accounts if no social accounts connected', function () {$this->socialAccount->delete();- $response = $this->actingAs($this->user)->post(route('posts.store'));+ $response = $this->actingAs($this->user)->post(route('app.posts.store'));- $response->assertRedirect(route('accounts'));+ $response->assertRedirect(route('app.accounts'));});test('store post creates draft and redirects to edit', function () {- $response = $this->actingAs($this->user)->post(route('posts.store'));+ $response = $this->actingAs($this->user)->post(route('app.posts.store'));$response->assertRedirect();@@ -114,7 +114,7 @@ test('edit post requires authentication', function () {'user_id' => $this->user->id,]);- $response = $this->get(route('posts.edit', $post));+ $response = $this->get(route('app.posts.edit', $post));$response->assertRedirect(route('login'));});@@ -131,7 +131,7 @@ test('edit post shows edit page', function () {'social_account_id' => $this->socialAccount->id,]);- $response = $this->actingAs($this->user)->get(route('posts.edit', $post));+ $response = $this->actingAs($this->user)->get(route('app.posts.edit', $post));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -148,7 +148,7 @@ test('edit post returns 404 for post from different workspace', function () {'user_id' => $this->user->id,]);- $response = $this->actingAs($this->user)->get(route('posts.edit', $post));+ $response = $this->actingAs($this->user)->get(route('app.posts.edit', $post));$response->assertNotFound();});@@ -165,7 +165,7 @@ test('edit post shows published posts in read-only mode', function () {'social_account_id' => $this->socialAccount->id,]);- $response = $this->actingAs($this->user)->get(route('posts.edit', $post));+ $response = $this->actingAs($this->user)->get(route('app.posts.edit', $post));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -181,7 +181,7 @@ test('update post requires authentication', function () {'user_id' => $this->user->id,]);- $response = $this->put(route('posts.update', $post), []);+ $response = $this->put(route('app.posts.update', $post), []);$response->assertRedirect(route('login'));});@@ -199,7 +199,7 @@ test('update post saves changes', function () {'content' => 'Original content',]);- $response = $this->actingAs($this->user)->put(route('posts.update', $post), [+ $response = $this->actingAs($this->user)->put(route('app.posts.update', $post), ['status' => 'draft','platforms' => [[@@ -223,7 +223,7 @@ test('update post cannot update published posts', function () {'status' => PostStatus::Published,]);- $response = $this->actingAs($this->user)->put(route('posts.update', $post), [+ $response = $this->actingAs($this->user)->put(route('app.posts.update', $post), ['status' => 'draft',]);@@ -246,7 +246,7 @@ test('publish now updates scheduled_at to current time', function () {'content' => 'Test content',]);- $response = $this->actingAs($this->user)->put(route('posts.update', $post), [+ $response = $this->actingAs($this->user)->put(route('app.posts.update', $post), ['status' => 'publishing','platforms' => [[@@ -270,7 +270,7 @@ test('destroy post requires authentication', function () {'user_id' => $this->user->id,]);- $response = $this->delete(route('posts.destroy', $post));+ $response = $this->delete(route('app.posts.destroy', $post));$response->assertRedirect(route('login'));});@@ -282,10 +282,10 @@ test('destroy post deletes the post and redirects back', function () {]);$response = $this->actingAs($this->user)- ->from(route('calendar'))- ->delete(route('posts.destroy', $post));+ ->from(route('app.calendar'))+ ->delete(route('app.posts.destroy', $post));- $response->assertRedirect(route('calendar'));+ $response->assertRedirect(route('app.calendar'));expect(Post::find($post->id))->toBeNull();});@@ -296,10 +296,10 @@ test('destroy post from status filter redirects back to filter', function (strin]);$response = $this->actingAs($this->user)- ->from(route('posts.index', ['status' => $status]))- ->delete(route('posts.destroy', $post));+ ->from(route('app.posts.index', ['status' => $status]))+ ->delete(route('app.posts.destroy', $post));- $response->assertRedirect(route('posts.index', ['status' => $status]));+ $response->assertRedirect(route('app.posts.index', ['status' => $status]));expect(Post::find($post->id))->toBeNull();})->with(['draft', 'scheduled', 'published']);@@ -310,9 +310,9 @@ test('destroy post with redirect param redirects to specified route', function (]);$response = $this->actingAs($this->user)- ->delete(route('posts.destroy', $post).'?redirect=posts.index');+ ->delete(route('app.posts.destroy', $post).'?redirect=app.posts.index');- $response->assertRedirect(route('posts.index'));+ $response->assertRedirect(route('app.posts.index'));expect(Post::find($post->id))->toBeNull();});@@ -323,7 +323,7 @@ test('destroy post returns 404 for post from different workspace', function () {'user_id' => $this->user->id,]);- $response = $this->actingAs($this->user)->delete(route('posts.destroy', $post));+ $response = $this->actingAs($this->user)->delete(route('app.posts.destroy', $post));$response->assertNotFound();});@@ -347,7 +347,7 @@ test('edit post includes workspace labels', function () {'color' => '#FF0000',]);- $response = $this->actingAs($this->user)->get(route('posts.edit', $post));+ $response = $this->actingAs($this->user)->get(route('app.posts.edit', $post));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -373,7 +373,7 @@ test('update post can attach labels', function () {'workspace_id' => $this->workspace->id,]);- $response = $this->actingAs($this->user)->put(route('posts.update', $post), [+ $response = $this->actingAs($this->user)->put(route('app.posts.update', $post), ['status' => 'draft','platforms' => [[@@ -410,7 +410,7 @@ test('update post can detach labels', function () {$post->labels()->attach($label);- $response = $this->actingAs($this->user)->put(route('posts.update', $post), [+ $response = $this->actingAs($this->user)->put(route('app.posts.update', $post), ['status' => 'draft','platforms' => [[@@ -448,7 +448,7 @@ test('update post can sync multiple labels', function () {$post->labels()->attach($label1);// Update with different labels- $response = $this->actingAs($this->user)->put(route('posts.update', $post), [+ $response = $this->actingAs($this->user)->put(route('app.posts.update', $post), ['status' => 'draft','platforms' => [[@@ -479,7 +479,7 @@ test('update post validates label_ids exist', function () {'social_account_id' => $this->socialAccount->id,]);- $response = $this->actingAs($this->user)->put(route('posts.update', $post), [+ $response = $this->actingAs($this->user)->put(route('app.posts.update', $post), ['status' => 'draft','platforms' => [[diff --git a/tests/Feature/Settings/PasswordUpdateTest.php b/tests/Feature/Settings/PasswordUpdateTest.phpindex 4e53a91cb..08d1fef93 100644--- a/tests/Feature/Settings/PasswordUpdateTest.php+++ b/tests/Feature/Settings/PasswordUpdateTest.php@@ -8,7 +8,7 @@ test('password update page is displayed', function () {$response = $this->actingAs($user)- ->get(route('user-password.edit'));+ ->get(route('app.user-password.edit'));$response->assertOk();});@@ -18,8 +18,8 @@ test('password can be updated', function () {$response = $this->actingAs($user)- ->from(route('user-password.edit'))- ->put(route('user-password.update'), [+ ->from(route('app.user-password.edit'))+ ->put(route('app.user-password.update'), ['current_password' => 'password','password' => 'new-password','password_confirmation' => 'new-password',@@ -27,7 +27,7 @@ test('password can be updated', function () {$response->assertSessionHasNoErrors()- ->assertRedirect(route('user-password.edit'));+ ->assertRedirect(route('app.user-password.edit'));expect(Hash::check('new-password', $user->refresh()->password))->toBeTrue();});@@ -37,8 +37,8 @@ test('correct password must be provided to update password', function () {$response = $this->actingAs($user)- ->from(route('user-password.edit'))- ->put(route('user-password.update'), [+ ->from(route('app.user-password.edit'))+ ->put(route('app.user-password.update'), ['current_password' => 'wrong-password','password' => 'new-password','password_confirmation' => 'new-password',@@ -46,5 +46,5 @@ test('correct password must be provided to update password', function () {$response->assertSessionHasErrors('current_password')- ->assertRedirect(route('user-password.edit'));-});\ No newline at end of file+ ->assertRedirect(route('app.user-password.edit'));+});diff --git a/tests/Feature/Settings/ProfileUpdateTest.php b/tests/Feature/Settings/ProfileUpdateTest.phpindex f4399214f..336524d80 100644--- a/tests/Feature/Settings/ProfileUpdateTest.php+++ b/tests/Feature/Settings/ProfileUpdateTest.php@@ -1,14 +1,16 @@<?php+use App\Enums\UserWorkspace\Role;use App\Models\Language;use App\Models\User;+use App\Models\Workspace;test('profile page is displayed', function () {$user = User::factory()->create();$response = $this->actingAs($user)- ->get(route('profile.edit'));+ ->get(route('app.profile.edit'));$response->assertOk();});@@ -18,14 +20,14 @@ test('profile information can be updated', function () {$response = $this->actingAs($user)- ->patch(route('profile.update'), [+ ->patch(route('app.profile.update'), ['name' => 'Test User','email' => '[email protected]',]);$response->assertSessionHasNoErrors()- ->assertRedirect(route('profile.edit'));+ ->assertRedirect(route('app.profile.edit'));$user->refresh();@@ -39,14 +41,14 @@ test('email verification status is unchanged when the email address is unchanged$response = $this->actingAs($user)- ->patch(route('profile.update'), [+ ->patch(route('app.profile.update'), ['name' => 'Test User','email' => $user->email,]);$response->assertSessionHasNoErrors()- ->assertRedirect(route('profile.edit'));+ ->assertRedirect(route('app.profile.edit'));expect($user->refresh()->email_verified_at)->not->toBeNull();});@@ -57,14 +59,14 @@ test('user can update their language', function () {$response = $this->actingAs($user)- ->from(route('posts.index'))- ->patch(route('profile.language'), [+ ->from(route('app.posts.index'))+ ->patch(route('app.profile.language'), ['language_id' => $newLanguage->id,]);$response->assertSessionHasNoErrors()- ->assertRedirect(route('posts.index'));+ ->assertRedirect(route('app.posts.index'));expect($user->refresh()->language_id)->toBe($newLanguage->id);});@@ -74,7 +76,7 @@ test('user cannot update language with invalid language id', function () {$response = $this->actingAs($user)- ->patch(route('profile.language'), [+ ->patch(route('app.profile.language'), ['language_id' => '00000000-0000-0000-0000-000000000000',]);@@ -86,13 +88,13 @@ test('user can delete their account', function () {$response = $this->actingAs($user)- ->delete(route('profile.destroy'), [+ ->delete(route('app.profile.destroy'), ['password' => 'password',]);$response->assertSessionHasNoErrors()- ->assertRedirect(route('home'));+ ->assertRedirect(route('app.home'));$this->assertGuest();expect($user->fresh())->toBeNull();@@ -103,14 +105,14 @@ test('correct password must be provided to delete account', function () {$response = $this->actingAs($user)- ->from(route('profile.edit'))- ->delete(route('profile.destroy'), [+ ->from(route('app.profile.edit'))+ ->delete(route('app.profile.destroy'), ['password' => 'wrong-password',]);$response->assertSessionHasErrors('password')- ->assertRedirect(route('profile.edit'));+ ->assertRedirect(route('app.profile.edit'));expect($user->fresh())->not->toBeNull();});@@ -120,12 +122,12 @@ test('deleting account updates members current_workspace_id when their workspace$member = User::factory()->create();// Create a workspace owned by the owner- $workspace = \App\Models\Workspace::factory()->create(['user_id' => $owner->id]);- $owner->workspaces()->attach($workspace->id, ['role' => \App\Enums\UserWorkspace\Role::Owner->value]);+ $workspace = Workspace::factory()->create(['user_id' => $owner->id]);+ $owner->workspaces()->attach($workspace->id, ['role' => Role::Owner->value]);$owner->update(['current_workspace_id' => $workspace->id]);// Add member to the workspace and set it as their current- $member->workspaces()->attach($workspace->id, ['role' => \App\Enums\UserWorkspace\Role::Member->value]);+ $member->workspaces()->attach($workspace->id, ['role' => Role::Member->value]);$member->update(['current_workspace_id' => $workspace->id]);// Verify setup@@ -134,7 +136,7 @@ test('deleting account updates members current_workspace_id when their workspace// Owner deletes their account$this->actingAs($owner)- ->delete(route('profile.destroy'), [+ ->delete(route('app.profile.destroy'), ['password' => 'password',]);@@ -148,17 +150,17 @@ test('deleting account updates members current_workspace_id to another workspace$otherOwner = User::factory()->create();// Create workspace owned by the owner being deleted- $workspaceToDelete = \App\Models\Workspace::factory()->create(['user_id' => $owner->id]);- $owner->workspaces()->attach($workspaceToDelete->id, ['role' => \App\Enums\UserWorkspace\Role::Owner->value]);+ $workspaceToDelete = Workspace::factory()->create(['user_id' => $owner->id]);+ $owner->workspaces()->attach($workspaceToDelete->id, ['role' => Role::Owner->value]);$owner->update(['current_workspace_id' => $workspaceToDelete->id]);// Create another workspace owned by a different user- $otherWorkspace = \App\Models\Workspace::factory()->create(['user_id' => $otherOwner->id]);- $otherOwner->workspaces()->attach($otherWorkspace->id, ['role' => \App\Enums\UserWorkspace\Role::Owner->value]);+ $otherWorkspace = Workspace::factory()->create(['user_id' => $otherOwner->id]);+ $otherOwner->workspaces()->attach($otherWorkspace->id, ['role' => Role::Owner->value]);// Add member to both workspaces- $member->workspaces()->attach($workspaceToDelete->id, ['role' => \App\Enums\UserWorkspace\Role::Member->value]);- $member->workspaces()->attach($otherWorkspace->id, ['role' => \App\Enums\UserWorkspace\Role::Member->value]);+ $member->workspaces()->attach($workspaceToDelete->id, ['role' => Role::Member->value]);+ $member->workspaces()->attach($otherWorkspace->id, ['role' => Role::Member->value]);$member->update(['current_workspace_id' => $workspaceToDelete->id]);// Verify setup@@ -167,7 +169,7 @@ test('deleting account updates members current_workspace_id to another workspace// Owner deletes their account$this->actingAs($owner)- ->delete(route('profile.destroy'), [+ ->delete(route('app.profile.destroy'), ['password' => 'password',]);diff --git a/tests/Feature/Social/BlueskyControllerTest.php b/tests/Feature/Social/BlueskyControllerTest.phpindex 5d6165bd5..6c79192de 100644--- a/tests/Feature/Social/BlueskyControllerTest.php+++ b/tests/Feature/Social/BlueskyControllerTest.php@@ -15,7 +15,7 @@ beforeEach(function () {});test('bluesky connect page can be rendered', function () {- $response = $this->actingAs($this->user)->get(route('social.bluesky.connect'));+ $response = $this->actingAs($this->user)->get(route('app.social.bluesky.connect'));$response->assertOk();});@@ -36,7 +36,7 @@ test('user can connect bluesky account with valid credentials', function () {], 200),]);- $response = $this->actingAs($this->user)->post(route('social.bluesky.store'), [+ $response = $this->actingAs($this->user)->post(route('app.social.bluesky.store'), ['identifier' => 'testuser.bsky.social','password' => 'xxxx-xxxx-xxxx-xxxx',]);@@ -62,7 +62,7 @@ test('user cannot connect bluesky with invalid credentials', function () {], 401),]);- $response = $this->actingAs($this->user)->post(route('social.bluesky.store'), [+ $response = $this->actingAs($this->user)->post(route('app.social.bluesky.store'), ['identifier' => 'testuser.bsky.social','password' => 'wrong-password',]);@@ -96,7 +96,7 @@ test('user cannot connect bluesky if already connected', function () {], 200),]);- $response = $this->actingAs($this->user)->post(route('social.bluesky.store'), [+ $response = $this->actingAs($this->user)->post(route('app.social.bluesky.store'), ['identifier' => 'newuser.bsky.social','password' => 'xxxx-xxxx-xxxx-xxxx',]);@@ -127,7 +127,7 @@ test('user can reconnect disconnected bluesky account', function () {], 200),]);- $response = $this->actingAs($this->user)->post(route('social.bluesky.store'), [+ $response = $this->actingAs($this->user)->post(route('app.social.bluesky.store'), ['identifier' => 'testuser.bsky.social','password' => 'xxxx-xxxx-xxxx-xxxx',]);@@ -141,7 +141,7 @@ test('user can reconnect disconnected bluesky account', function () {});test('bluesky connection validates required fields', function () {- $response = $this->actingAs($this->user)->post(route('social.bluesky.store'), [+ $response = $this->actingAs($this->user)->post(route('app.social.bluesky.store'), ['identifier' => '','password' => '',]);diff --git a/tests/Feature/Social/FacebookControllerTest.php b/tests/Feature/Social/FacebookControllerTest.phpindex 16ba4fbf4..9d9040273 100644--- a/tests/Feature/Social/FacebookControllerTest.php+++ b/tests/Feature/Social/FacebookControllerTest.php@@ -28,7 +28,7 @@ test('facebook connect redirects to oauth provider', function () {$response = $this->actingAs($this->user)->withHeader('X-Inertia', 'true')- ->get(route('social.facebook.connect'));+ ->get(route('app.social.facebook.connect'));$response->assertStatus(409); // Inertia::location returns 409 with X-Inertia header@@ -64,7 +64,7 @@ test('facebook oauth callback creates account with single page', function () {], 200),]);- $response = $this->actingAs($this->user)->get(route('social.facebook.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.facebook.callback'));$response->assertOk();$response->assertViewIs('auth.social-callback');@@ -116,9 +116,9 @@ test('facebook callback redirects to page selection when multiple pages', functi], 200),]);- $response = $this->actingAs($this->user)->get(route('social.facebook.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.facebook.callback'));- $response->assertRedirect(route('social.facebook.select-page'));+ $response->assertRedirect(route('app.social.facebook.select-page'));expect(session('facebook_oauth'))->not->toBeNull();});@@ -143,7 +143,7 @@ test('facebook callback fails when no pages found', function () {], 200),]);- $response = $this->actingAs($this->user)->get(route('social.facebook.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.facebook.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -153,7 +153,7 @@ test('facebook callback fails when no pages found', function () {test('facebook callback fails with expired session', function () {// No session data - simulating expired session- $response = $this->actingAs($this->user)->get(route('social.facebook.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.facebook.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -193,7 +193,7 @@ test('user cannot connect facebook if already connected', function () {], 200),]);- $response = $this->actingAs($this->user)->get(route('social.facebook.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.facebook.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -236,7 +236,7 @@ test('user can reconnect disconnected facebook account', function () {], 200),]);- $response = $this->actingAs($this->user)->get(route('social.facebook.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.facebook.callback'));$response->assertOk();$response->assertViewHas('success', true);@@ -252,13 +252,13 @@ test('facebook callback handles oauth errors gracefully', function () {]);$mock = Mockery::mock();- $mock->shouldReceive('user')->andThrow(new \Exception('OAuth error'));+ $mock->shouldReceive('user')->andThrow(new Exception('OAuth error'));Socialite::shouldReceive('driver')->with('facebook')->andReturn($mock);- $response = $this->actingAs($this->user)->get(route('social.facebook.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.facebook.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -290,7 +290,7 @@ test('facebook page selection creates account', function () {],]);- $response = $this->actingAs($this->user)->post(route('social.facebook.select'), [+ $response = $this->actingAs($this->user)->post(route('app.social.facebook.select'), ['page_id' => 'page_123',]);@@ -308,7 +308,7 @@ test('facebook page selection creates account', function () {test('facebook page selection fails with expired session', function () {// No session data- $response = $this->actingAs($this->user)->post(route('social.facebook.select'), [+ $response = $this->actingAs($this->user)->post(route('app.social.facebook.select'), ['page_id' => 'page_123',]);@@ -334,7 +334,7 @@ test('facebook page selection fails with invalid page id', function () {],]);- $response = $this->actingAs($this->user)->post(route('social.facebook.select'), [+ $response = $this->actingAs($this->user)->post(route('app.social.facebook.select'), ['page_id' => 'invalid_page_id',]);diff --git a/tests/Feature/Social/InstagramControllerTest.php b/tests/Feature/Social/InstagramControllerTest.phpindex 120e6beee..007c56977 100644--- a/tests/Feature/Social/InstagramControllerTest.php+++ b/tests/Feature/Social/InstagramControllerTest.php@@ -27,7 +27,7 @@ test('instagram connect redirects to oauth provider', function () {$response = $this->actingAs($this->user)->withHeader('X-Inertia', 'true')- ->get(route('social.instagram.connect'));+ ->get(route('app.social.instagram.connect'));$response->assertStatus(409);@@ -55,7 +55,7 @@ test('instagram oauth callback creates account', function () {'user' => $socialiteUser,]));- $response = $this->actingAs($this->user)->get(route('social.instagram.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.instagram.callback'));$response->assertOk();$response->assertViewIs('auth.social-callback');@@ -71,7 +71,7 @@ test('instagram oauth callback creates account', function () {});test('instagram callback fails with expired session', function () {- $response = $this->actingAs($this->user)->get(route('social.instagram.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.instagram.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -106,7 +106,7 @@ test('user cannot connect instagram if already connected', function () {'user' => $socialiteUser,]));- $response = $this->actingAs($this->user)->get(route('social.instagram.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.instagram.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -141,7 +141,7 @@ test('user can reconnect disconnected instagram account', function () {'user' => $socialiteUser,]));- $response = $this->actingAs($this->user)->get(route('social.instagram.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.instagram.callback'));$response->assertOk();$response->assertViewHas('success', true);@@ -157,13 +157,13 @@ test('instagram callback handles oauth errors gracefully', function () {]);$mock = Mockery::mock();- $mock->shouldReceive('user')->andThrow(new \Exception('OAuth error'));+ $mock->shouldReceive('user')->andThrow(new Exception('OAuth error'));Socialite::shouldReceive('driver')->with('instagram')->andReturn($mock);- $response = $this->actingAs($this->user)->get(route('social.instagram.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.instagram.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -173,7 +173,7 @@ test('instagram callback handles oauth errors gracefully', function () {test('instagram connect redirects to create workspace if none exists', function () {$this->user->update(['current_workspace_id' => null]);- $response = $this->actingAs($this->user)->get(route('social.instagram.connect'));+ $response = $this->actingAs($this->user)->get(route('app.social.instagram.connect'));- $response->assertRedirect(route('workspaces.create'));+ $response->assertRedirect(route('app.workspaces.create'));});diff --git a/tests/Feature/Social/LinkedInControllerTest.php b/tests/Feature/Social/LinkedInControllerTest.phpindex 5629773cc..da540daed 100644--- a/tests/Feature/Social/LinkedInControllerTest.php+++ b/tests/Feature/Social/LinkedInControllerTest.php@@ -28,7 +28,7 @@ test('linkedin connect redirects to oauth provider', function () {$response = $this->actingAs($this->user)->withHeader('X-Inertia', 'true')- ->get(route('social.linkedin.connect'));+ ->get(route('app.social.linkedin.connect'));$response->assertStatus(409); // Inertia::location returns 409 with X-Inertia header@@ -65,7 +65,7 @@ test('linkedin oauth callback creates account', function () {], 200),]);- $response = $this->actingAs($this->user)->get(route('social.linkedin.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.linkedin.callback'));$response->assertOk();$response->assertViewIs('auth.social-callback');@@ -83,7 +83,7 @@ test('linkedin oauth callback creates account', function () {test('linkedin callback fails with expired session', function () {// No session data - simulating expired session- $response = $this->actingAs($this->user)->get(route('social.linkedin.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.linkedin.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -115,7 +115,7 @@ test('user cannot connect linkedin if already connected', function () {'user' => $socialiteUser,]));- $response = $this->actingAs($this->user)->get(route('social.linkedin.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.linkedin.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -154,7 +154,7 @@ test('user can reconnect disconnected linkedin account', function () {], 200),]);- $response = $this->actingAs($this->user)->get(route('social.linkedin.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.linkedin.callback'));$response->assertOk();$response->assertViewHas('success', true);@@ -170,13 +170,13 @@ test('linkedin callback handles oauth errors gracefully', function () {]);$mock = Mockery::mock();- $mock->shouldReceive('user')->andThrow(new \Exception('OAuth error'));+ $mock->shouldReceive('user')->andThrow(new Exception('OAuth error'));Socialite::shouldReceive('driver')->with('linkedin')->andReturn($mock);- $response = $this->actingAs($this->user)->get(route('social.linkedin.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.linkedin.callback'));$response->assertOk();$response->assertViewHas('success', false);diff --git a/tests/Feature/Social/LinkedInPageControllerTest.php b/tests/Feature/Social/LinkedInPageControllerTest.phpindex 84fc110b3..37ba30265 100644--- a/tests/Feature/Social/LinkedInPageControllerTest.php+++ b/tests/Feature/Social/LinkedInPageControllerTest.php@@ -29,7 +29,7 @@ test('linkedin page connect redirects to oauth provider', function () {$response = $this->actingAs($this->user)->withHeader('X-Inertia', 'true')- ->get(route('social.linkedin-page.connect'));+ ->get(route('app.social.linkedin-page.connect'));$response->assertStatus(409); // Inertia::location returns 409 with X-Inertia header@@ -72,9 +72,9 @@ test('linkedin page oauth callback fetches organizations', function () {], 200),]);- $response = $this->actingAs($this->user)->get(route('social.linkedin-page.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.linkedin-page.callback'));- $response->assertRedirect(route('social.linkedin-page.select-page'));+ $response->assertRedirect(route('app.social.linkedin-page.select-page'));expect(session('linkedin_page_pending'))->not->toBeNull();expect(session('linkedin_page_pending.organizations'))->toHaveCount(1);@@ -108,7 +108,7 @@ test('linkedin page callback fails when user has no organizations', function ()], 200),]);- $response = $this->actingAs($this->user)->get(route('social.linkedin-page.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.linkedin-page.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -118,7 +118,7 @@ test('linkedin page callback fails when user has no organizations', function ()test('linkedin page callback fails with expired session', function () {// No session data - simulating expired session- $response = $this->actingAs($this->user)->get(route('social.linkedin-page.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.linkedin-page.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -141,7 +141,7 @@ test('linkedin page select creates account', function () {],]);- $response = $this->actingAs($this->user)->post(route('social.linkedin-page.select'), [+ $response = $this->actingAs($this->user)->post(route('app.social.linkedin-page.select'), ['organization_id' => 123456,'organization_name' => 'Test Company','organization_vanity_name' => 'testcompany',@@ -165,7 +165,7 @@ test('linkedin page select creates account', function () {test('linkedin page select fails with expired session', function () {// No session data- $response = $this->actingAs($this->user)->post(route('social.linkedin-page.select'), [+ $response = $this->actingAs($this->user)->post(route('app.social.linkedin-page.select'), ['organization_id' => 123456,'organization_name' => 'Test Company','organization_vanity_name' => 'testcompany',@@ -183,7 +183,7 @@ test('user cannot connect linkedin page if already connected via connect route',]);// The "already connected" check happens in the connect method, not callback- $response = $this->actingAs($this->user)->get(route('social.linkedin-page.connect'));+ $response = $this->actingAs($this->user)->get(route('app.social.linkedin-page.connect'));$response->assertRedirect();$response->assertSessionHas('flash.banner', __('accounts.flash.already_connected'));@@ -212,7 +212,7 @@ test('user can reconnect disconnected linkedin page account', function () {],]);- $response = $this->actingAs($this->user)->post(route('social.linkedin-page.select'), [+ $response = $this->actingAs($this->user)->post(route('app.social.linkedin-page.select'), ['organization_id' => 123456,'organization_name' => 'Test Company','organization_vanity_name' => 'testcompany',@@ -235,13 +235,13 @@ test('linkedin page callback handles oauth errors gracefully', function () {$socialiteMock = Mockery::mock();$socialiteMock->shouldReceive('scopes')->andReturn($socialiteMock);$socialiteMock->shouldReceive('with')->andReturn($socialiteMock);- $socialiteMock->shouldReceive('user')->andThrow(new \Exception('OAuth error'));+ $socialiteMock->shouldReceive('user')->andThrow(new Exception('OAuth error'));Socialite::shouldReceive('driver')->with('linkedin-openid')->andReturn($socialiteMock);- $response = $this->actingAs($this->user)->get(route('social.linkedin-page.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.linkedin-page.callback'));$response->assertOk();$response->assertViewHas('success', false);diff --git a/tests/Feature/Social/MastodonControllerTest.php b/tests/Feature/Social/MastodonControllerTest.phpindex 92d3f8c4e..57111ade9 100644--- a/tests/Feature/Social/MastodonControllerTest.php+++ b/tests/Feature/Social/MastodonControllerTest.php@@ -15,7 +15,7 @@ beforeEach(function () {});test('mastodon connect page can be rendered', function () {- $response = $this->actingAs($this->user)->get(route('social.mastodon.connect'));+ $response = $this->actingAs($this->user)->get(route('app.social.mastodon.connect'));$response->assertOk();});@@ -27,13 +27,13 @@ test('user can initiate mastodon oauth flow', function () {'client_secret' => 'test-client-secret','id' => '12345','name' => config('app.name'),- 'redirect_uri' => route('social.mastodon.callback'),+ 'redirect_uri' => route('app.social.mastodon.callback'),], 200),]);$response = $this->actingAs($this->user)->withHeader('X-Inertia', 'true')- ->post(route('social.mastodon.authorize'), [+ ->post(route('app.social.mastodon.authorize'), ['instance' => 'https://mastodon.social',]);@@ -49,7 +49,7 @@ test('user cannot connect to invalid mastodon instance', function () {'https://invalid-instance.com/api/v1/apps' => Http::response([], 404),]);- $response = $this->actingAs($this->user)->post(route('social.mastodon.authorize'), [+ $response = $this->actingAs($this->user)->post(route('app.social.mastodon.authorize'), ['instance' => 'https://invalid-instance.com',]);@@ -83,7 +83,7 @@ test('mastodon oauth callback creates account', function () {], 200),]);- $response = $this->actingAs($this->user)->get(route('social.mastodon.callback', [+ $response = $this->actingAs($this->user)->get(route('app.social.mastodon.callback', ['code' => 'test-auth-code','state' => 'test-state',]));@@ -110,7 +110,7 @@ test('mastodon callback fails with invalid state', function () {'social_connect_workspace' => $this->workspace->id,]);- $response = $this->actingAs($this->user)->get(route('social.mastodon.callback', [+ $response = $this->actingAs($this->user)->get(route('app.social.mastodon.callback', ['code' => 'test-auth-code','state' => 'wrong-state',]));@@ -127,7 +127,7 @@ test('mastodon callback fails with invalid state', function () {test('mastodon callback fails with expired session', function () {// No session data - simulating expired session- $response = $this->actingAs($this->user)->get(route('social.mastodon.callback', [+ $response = $this->actingAs($this->user)->get(route('app.social.mastodon.callback', ['code' => 'test-auth-code','state' => 'test-state',]));@@ -164,7 +164,7 @@ test('user cannot connect mastodon if already connected', function () {], 200),]);- $response = $this->actingAs($this->user)->get(route('social.mastodon.callback', [+ $response = $this->actingAs($this->user)->get(route('app.social.mastodon.callback', ['code' => 'test-auth-code','state' => 'test-state',]));@@ -201,7 +201,7 @@ test('user can reconnect disconnected mastodon account', function () {], 200),]);- $response = $this->actingAs($this->user)->get(route('social.mastodon.callback', [+ $response = $this->actingAs($this->user)->get(route('app.social.mastodon.callback', ['code' => 'test-auth-code','state' => 'test-state',]));@@ -215,7 +215,7 @@ test('user can reconnect disconnected mastodon account', function () {});test('mastodon connection validates instance url', function () {- $response = $this->actingAs($this->user)->post(route('social.mastodon.authorize'), [+ $response = $this->actingAs($this->user)->post(route('app.social.mastodon.authorize'), ['instance' => 'not-a-valid-url',]);@@ -234,7 +234,7 @@ test('mastodon works with custom instances', function () {$response = $this->actingAs($this->user)->withHeader('X-Inertia', 'true')- ->post(route('social.mastodon.authorize'), [+ ->post(route('app.social.mastodon.authorize'), ['instance' => 'https://techhub.social',]);diff --git a/tests/Feature/Social/PinterestControllerTest.php b/tests/Feature/Social/PinterestControllerTest.phpindex f8945740a..b318b9462 100644--- a/tests/Feature/Social/PinterestControllerTest.php+++ b/tests/Feature/Social/PinterestControllerTest.php@@ -27,7 +27,7 @@ test('pinterest connect redirects to oauth provider', function () {$response = $this->actingAs($this->user)->withHeader('X-Inertia', 'true')- ->get(route('social.pinterest.connect'));+ ->get(route('app.social.pinterest.connect'));$response->assertStatus(409); // Inertia::location returns 409 with X-Inertia header@@ -55,7 +55,7 @@ test('pinterest oauth callback creates account', function () {'user' => $socialiteUser,]));- $response = $this->actingAs($this->user)->get(route('social.pinterest.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.pinterest.callback'));$response->assertOk();$response->assertViewIs('auth.social-callback');@@ -73,7 +73,7 @@ test('pinterest oauth callback creates account', function () {test('pinterest callback fails with expired session', function () {// No session data - simulating expired session- $response = $this->actingAs($this->user)->get(route('social.pinterest.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.pinterest.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -105,7 +105,7 @@ test('user cannot connect pinterest if already connected', function () {'user' => $socialiteUser,]));- $response = $this->actingAs($this->user)->get(route('social.pinterest.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.pinterest.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -138,7 +138,7 @@ test('user can reconnect disconnected pinterest account', function () {'user' => $socialiteUser,]));- $response = $this->actingAs($this->user)->get(route('social.pinterest.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.pinterest.callback'));$response->assertOk();$response->assertViewHas('success', true);@@ -154,13 +154,13 @@ test('pinterest callback handles oauth errors gracefully', function () {]);$mock = Mockery::mock();- $mock->shouldReceive('user')->andThrow(new \Exception('OAuth error'));+ $mock->shouldReceive('user')->andThrow(new Exception('OAuth error'));Socialite::shouldReceive('driver')->with('pinterest')->andReturn($mock);- $response = $this->actingAs($this->user)->get(route('social.pinterest.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.pinterest.callback'));$response->assertOk();$response->assertViewHas('success', false);diff --git a/tests/Feature/Social/ThreadsControllerTest.php b/tests/Feature/Social/ThreadsControllerTest.phpindex cb353f92f..edfee4d02 100644--- a/tests/Feature/Social/ThreadsControllerTest.php+++ b/tests/Feature/Social/ThreadsControllerTest.php@@ -17,7 +17,7 @@ beforeEach(function () {test('threads connect redirects to oauth', function () {$response = $this->actingAs($this->user)->withHeader('X-Inertia', 'true')- ->get(route('social.threads.connect'));+ ->get(route('app.social.threads.connect'));$response->assertStatus(409); // Inertia::location returns 409 with X-Inertia header@@ -50,7 +50,7 @@ test('threads oauth callback creates account', function () {], 200),]);- $response = $this->actingAs($this->user)->get(route('social.threads.callback', [+ $response = $this->actingAs($this->user)->get(route('app.social.threads.callback', ['code' => 'test-auth-code','state' => $state,]));@@ -74,7 +74,7 @@ test('threads callback fails with invalid state', function () {'threads_oauth_state' => 'correct-state',]);- $response = $this->actingAs($this->user)->get(route('social.threads.callback', [+ $response = $this->actingAs($this->user)->get(route('app.social.threads.callback', ['code' => 'test-auth-code','state' => 'wrong-state',]));@@ -92,7 +92,7 @@ test('threads callback fails with invalid state', function () {test('threads callback fails with expired session', function () {// No session data - simulating expired session- $response = $this->actingAs($this->user)->get(route('social.threads.callback', [+ $response = $this->actingAs($this->user)->get(route('app.social.threads.callback', ['code' => 'test-auth-code','state' => 'test-state',]));@@ -131,7 +131,7 @@ test('user cannot connect threads if already connected', function () {], 200),]);- $response = $this->actingAs($this->user)->get(route('social.threads.callback', [+ $response = $this->actingAs($this->user)->get(route('app.social.threads.callback', ['code' => 'test-auth-code','state' => $state,]));@@ -171,7 +171,7 @@ test('user can reconnect disconnected threads account', function () {], 200),]);- $response = $this->actingAs($this->user)->get(route('social.threads.callback', [+ $response = $this->actingAs($this->user)->get(route('app.social.threads.callback', ['code' => 'test-auth-code','state' => $state,]));@@ -199,7 +199,7 @@ test('threads callback handles token exchange failure', function () {], 400),]);- $response = $this->actingAs($this->user)->get(route('social.threads.callback', [+ $response = $this->actingAs($this->user)->get(route('app.social.threads.callback', ['code' => 'expired-auth-code','state' => $state,]));diff --git a/tests/Feature/Social/TikTokControllerTest.php b/tests/Feature/Social/TikTokControllerTest.phpindex e5bfafa4d..d20bf6794 100644--- a/tests/Feature/Social/TikTokControllerTest.php+++ b/tests/Feature/Social/TikTokControllerTest.php@@ -27,7 +27,7 @@ test('tiktok connect redirects to oauth provider', function () {$response = $this->actingAs($this->user)->withHeader('X-Inertia', 'true')- ->get(route('social.tiktok.connect'));+ ->get(route('app.social.tiktok.connect'));$response->assertStatus(409); // Inertia::location returns 409 with X-Inertia header@@ -57,7 +57,7 @@ test('tiktok oauth callback creates account', function () {->with('tiktok')->andReturn($socialiteMock);- $response = $this->actingAs($this->user)->get(route('social.tiktok.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.tiktok.callback'));$response->assertOk();$response->assertViewIs('auth.social-callback');@@ -75,7 +75,7 @@ test('tiktok oauth callback creates account', function () {test('tiktok callback fails with expired session', function () {// No session data - simulating expired session- $response = $this->actingAs($this->user)->get(route('social.tiktok.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.tiktok.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -109,7 +109,7 @@ test('user cannot connect tiktok if already connected', function () {->with('tiktok')->andReturn($socialiteMock);- $response = $this->actingAs($this->user)->get(route('social.tiktok.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.tiktok.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -145,7 +145,7 @@ test('user can reconnect disconnected tiktok account', function () {->with('tiktok')->andReturn($socialiteMock);- $response = $this->actingAs($this->user)->get(route('social.tiktok.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.tiktok.callback'));$response->assertOk();$response->assertViewHas('success', true);@@ -162,13 +162,13 @@ test('tiktok callback handles oauth errors gracefully', function () {$mock = Mockery::mock();$mock->shouldReceive('scopes')->andReturn($mock);- $mock->shouldReceive('user')->andThrow(new \Exception('OAuth error'));+ $mock->shouldReceive('user')->andThrow(new Exception('OAuth error'));Socialite::shouldReceive('driver')->with('tiktok')->andReturn($mock);- $response = $this->actingAs($this->user)->get(route('social.tiktok.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.tiktok.callback'));$response->assertOk();$response->assertViewHas('success', false);diff --git a/tests/Feature/Social/XControllerTest.php b/tests/Feature/Social/XControllerTest.phpindex 39635c099..92c7fc91d 100644--- a/tests/Feature/Social/XControllerTest.php+++ b/tests/Feature/Social/XControllerTest.php@@ -27,7 +27,7 @@ test('x connect redirects to oauth provider', function () {$response = $this->actingAs($this->user)->withHeader('X-Inertia', 'true')- ->get(route('social.x.connect'));+ ->get(route('app.social.x.connect'));$response->assertStatus(409); // Inertia::location returns 409 with X-Inertia header@@ -55,7 +55,7 @@ test('x oauth callback creates account', function () {'user' => $socialiteUser,]));- $response = $this->actingAs($this->user)->get(route('social.x.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.x.callback'));$response->assertOk();$response->assertViewIs('auth.social-callback');@@ -73,7 +73,7 @@ test('x oauth callback creates account', function () {test('x callback fails with expired session', function () {// No session data - simulating expired session- $response = $this->actingAs($this->user)->get(route('social.x.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.x.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -105,7 +105,7 @@ test('user cannot connect x if already connected', function () {'user' => $socialiteUser,]));- $response = $this->actingAs($this->user)->get(route('social.x.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.x.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -138,7 +138,7 @@ test('user can reconnect disconnected x account', function () {'user' => $socialiteUser,]));- $response = $this->actingAs($this->user)->get(route('social.x.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.x.callback'));$response->assertOk();$response->assertViewHas('success', true);@@ -154,13 +154,13 @@ test('x callback handles oauth errors gracefully', function () {]);$mock = Mockery::mock();- $mock->shouldReceive('user')->andThrow(new \Exception('OAuth error'));+ $mock->shouldReceive('user')->andThrow(new Exception('OAuth error'));Socialite::shouldReceive('driver')->with('x')->andReturn($mock);- $response = $this->actingAs($this->user)->get(route('social.x.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.x.callback'));$response->assertOk();$response->assertViewHas('success', false);diff --git a/tests/Feature/Social/YouTubeControllerTest.php b/tests/Feature/Social/YouTubeControllerTest.phpindex f29da1890..e51d82613 100644--- a/tests/Feature/Social/YouTubeControllerTest.php+++ b/tests/Feature/Social/YouTubeControllerTest.php@@ -29,7 +29,7 @@ test('youtube connect redirects to oauth provider', function () {$response = $this->actingAs($this->user)->withHeader('X-Inertia', 'true')- ->get(route('social.youtube.connect'));+ ->get(route('app.social.youtube.connect'));$response->assertStatus(409); // Inertia::location returns 409 with X-Inertia header@@ -74,7 +74,7 @@ test('youtube oauth callback creates account with single channel', function () {], 200),]);- $response = $this->actingAs($this->user)->get(route('social.youtube.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.youtube.callback'));$response->assertOk();$response->assertViewIs('auth.social-callback');@@ -132,9 +132,9 @@ test('youtube callback redirects to channel selection when multiple channels', f], 200),]);- $response = $this->actingAs($this->user)->get(route('social.youtube.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.youtube.callback'));- $response->assertRedirect(route('social.youtube.select-channel'));+ $response->assertRedirect(route('app.social.youtube.select-channel'));expect(session('youtube_oauth'))->not->toBeNull();});@@ -161,7 +161,7 @@ test('youtube callback fails when no channels found', function () {], 200),]);- $response = $this->actingAs($this->user)->get(route('social.youtube.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.youtube.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -171,7 +171,7 @@ test('youtube callback fails when no channels found', function () {test('youtube callback fails with expired session', function () {// No session data - simulating expired session- $response = $this->actingAs($this->user)->get(route('social.youtube.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.youtube.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -216,7 +216,7 @@ test('user cannot connect youtube if already connected', function () {], 200),]);- $response = $this->actingAs($this->user)->get(route('social.youtube.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.youtube.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -263,7 +263,7 @@ test('user can reconnect disconnected youtube account', function () {], 200),]);- $response = $this->actingAs($this->user)->get(route('social.youtube.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.youtube.callback'));$response->assertOk();$response->assertViewHas('success', true);@@ -279,13 +279,13 @@ test('youtube callback handles oauth errors gracefully', function () {]);$mock = Mockery::mock();- $mock->shouldReceive('user')->andThrow(new \Exception('OAuth error'));+ $mock->shouldReceive('user')->andThrow(new Exception('OAuth error'));Socialite::shouldReceive('driver')->with('google')->andReturn($mock);- $response = $this->actingAs($this->user)->get(route('social.youtube.callback'));+ $response = $this->actingAs($this->user)->get(route('app.social.youtube.callback'));$response->assertOk();$response->assertViewHas('success', false);@@ -320,7 +320,7 @@ test('youtube channel selection creates account', function () {], 200),]);- $response = $this->actingAs($this->user)->post(route('social.youtube.select'), [+ $response = $this->actingAs($this->user)->post(route('app.social.youtube.select'), ['channel_id' => 'UC_channel_123',]);@@ -338,7 +338,7 @@ test('youtube channel selection creates account', function () {test('youtube channel selection fails with expired session', function () {// No session data- $response = $this->actingAs($this->user)->post(route('social.youtube.select'), [+ $response = $this->actingAs($this->user)->post(route('app.social.youtube.select'), ['channel_id' => 'UC_channel_123',]);diff --git a/tests/Feature/SocialControllerTest.php b/tests/Feature/SocialControllerTest.phpindex 120769920..516bc0353 100644--- a/tests/Feature/SocialControllerTest.php+++ b/tests/Feature/SocialControllerTest.php@@ -14,7 +14,7 @@ beforeEach(function () {// Index teststest('accounts index requires authentication', function () {- $response = $this->get(route('accounts'));+ $response = $this->get(route('app.accounts'));$response->assertRedirect(route('login'));});@@ -25,7 +25,7 @@ test('accounts index shows platforms and connected accounts', function () {'platform' => Platform::LinkedIn,]);- $response = $this->actingAs($this->user)->get(route('accounts'));+ $response = $this->actingAs($this->user)->get(route('app.accounts'));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -38,16 +38,16 @@ test('accounts index shows platforms and connected accounts', function () {test('accounts index redirects if no workspace', function () {$this->user->update(['current_workspace_id' => null]);- $response = $this->actingAs($this->user)->get(route('accounts'));+ $response = $this->actingAs($this->user)->get(route('app.accounts'));- $response->assertRedirect(route('workspaces.create'));+ $response->assertRedirect(route('app.workspaces.create'));});// Disconnect teststest('disconnect requires authentication', function () {$account = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id]);- $response = $this->delete(route('accounts.disconnect', $account));+ $response = $this->delete(route('app.accounts.disconnect', $account));$response->assertRedirect(route('login'));});@@ -55,7 +55,7 @@ test('disconnect requires authentication', function () {test('disconnect removes social account', function () {$account = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id]);- $response = $this->actingAs($this->user)->delete(route('accounts.disconnect', $account));+ $response = $this->actingAs($this->user)->delete(route('app.accounts.disconnect', $account));$response->assertRedirect();expect(SocialAccount::find($account->id))->toBeNull();@@ -65,7 +65,7 @@ test('disconnect returns 403 for other workspace account', function () {$otherWorkspace = Workspace::factory()->create();$account = SocialAccount::factory()->create(['workspace_id' => $otherWorkspace->id]);- $response = $this->actingAs($this->user)->delete(route('accounts.disconnect', $account));+ $response = $this->actingAs($this->user)->delete(route('app.accounts.disconnect', $account));$response->assertForbidden();});diff --git a/tests/Feature/VerifyWorkspaceConnectionsTest.php b/tests/Feature/VerifyWorkspaceConnectionsTest.phpindex b39592a1d..b2ff3018e 100644--- a/tests/Feature/VerifyWorkspaceConnectionsTest.php+++ b/tests/Feature/VerifyWorkspaceConnectionsTest.php@@ -94,10 +94,10 @@ test('job only includes failed accounts in email', function () {$verifier = mock(ConnectionVerifier::class);$verifier->shouldReceive('verify')- ->with(\Mockery::on(fn ($acc) => $acc->id === $validAccount->id))+ ->with(Mockery::on(fn ($acc) => $acc->id === $validAccount->id))->andReturn(true);$verifier->shouldReceive('verify')- ->with(\Mockery::on(fn ($acc) => $acc->id === $invalidAccount->id))+ ->with(Mockery::on(fn ($acc) => $acc->id === $invalidAccount->id))->andThrow(new TokenExpiredException('Token expired'));app()->instance(ConnectionVerifier::class, $verifier);diff --git a/tests/Feature/WorkspaceControllerTest.php b/tests/Feature/WorkspaceControllerTest.phpindex 0c8b37f81..b00a50ca3 100644--- a/tests/Feature/WorkspaceControllerTest.php+++ b/tests/Feature/WorkspaceControllerTest.php@@ -13,7 +13,7 @@ beforeEach(function () {// Index teststest('workspaces index requires authentication', function () {- $response = $this->get(route('workspaces.index'));+ $response = $this->get(route('app.workspaces.index'));$response->assertRedirect(route('login'));});@@ -24,7 +24,7 @@ test('workspaces index shows all workspaces for user', function () {$workspace->members()->attach($this->user->id, ['role' => 'owner']);}- $response = $this->actingAs($this->user)->get(route('workspaces.index'));+ $response = $this->actingAs($this->user)->get(route('app.workspaces.index'));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -36,7 +36,7 @@ test('workspaces index shows all workspaces for user', function () {// Create teststest('create workspace requires authentication', function () {- $response = $this->get(route('workspaces.create'));+ $response = $this->get(route('app.workspaces.create'));$response->assertRedirect(route('login'));});@@ -46,7 +46,7 @@ test('create workspace shows form for user with no workspaces', function () {$this->user->update(['current_workspace_id' => null]);$this->workspace->delete();- $response = $this->actingAs($this->user)->get(route('workspaces.create'));+ $response = $this->actingAs($this->user)->get(route('app.workspaces.create'));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -57,7 +57,7 @@ test('create workspace shows form for user with no workspaces', function () {test('create workspace shows form when user already has workspace in self-hosted mode', function () {config(['trypost.self_hosted' => true]);- $response = $this->actingAs($this->user)->get(route('workspaces.create'));+ $response = $this->actingAs($this->user)->get(route('app.workspaces.create'));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -67,7 +67,7 @@ test('create workspace shows form when user already has workspace in self-hosted// Store teststest('store workspace requires authentication', function () {- $response = $this->post(route('workspaces.store'), ['name' => 'Test Workspace']);+ $response = $this->post(route('app.workspaces.store'), ['name' => 'Test Workspace']);$response->assertRedirect(route('login'));});@@ -77,11 +77,11 @@ test('store workspace creates first workspace', function () {$this->user->update(['current_workspace_id' => null]);$this->workspace->delete();- $response = $this->actingAs($this->user)->post(route('workspaces.store'), [+ $response = $this->actingAs($this->user)->post(route('app.workspaces.store'), ['name' => 'New Workspace',]);- $response->assertRedirect(route('calendar'));+ $response->assertRedirect(route('app.calendar'));$this->assertDatabaseHas('workspaces', ['name' => 'New Workspace',@@ -92,11 +92,11 @@ test('store workspace creates first workspace', function () {test('store workspace creates second workspace in self-hosted mode', function () {config(['trypost.self_hosted' => true]);- $response = $this->actingAs($this->user)->post(route('workspaces.store'), [+ $response = $this->actingAs($this->user)->post(route('app.workspaces.store'), ['name' => 'Second Workspace',]);- $response->assertRedirect(route('calendar'));+ $response->assertRedirect(route('app.calendar'));$this->assertDatabaseHas('workspaces', ['name' => 'Second Workspace',@@ -105,7 +105,7 @@ test('store workspace creates second workspace in self-hosted mode', function ()});test('store workspace validates name is required', function () {- $response = $this->actingAs($this->user)->post(route('workspaces.store'), [+ $response = $this->actingAs($this->user)->post(route('app.workspaces.store'), ['name' => '',]);@@ -117,7 +117,7 @@ test('store workspace sets new workspace as current', function () {$this->user->update(['current_workspace_id' => null]);$this->workspace->delete();- $this->actingAs($this->user)->post(route('workspaces.store'), [+ $this->actingAs($this->user)->post(route('app.workspaces.store'), ['name' => 'New Workspace',]);@@ -129,7 +129,7 @@ test('store workspace sets new workspace as current', function () {// Switch teststest('switch workspace requires authentication', function () {- $response = $this->post(route('workspaces.switch', $this->workspace));+ $response = $this->post(route('app.workspaces.switch', $this->workspace));$response->assertRedirect(route('login'));});@@ -138,9 +138,9 @@ test('switch workspace changes current workspace', function () {$otherWorkspace = Workspace::factory()->create(['user_id' => $this->user->id]);$otherWorkspace->members()->attach($this->user->id, ['role' => 'owner']);- $response = $this->actingAs($this->user)->post(route('workspaces.switch', $otherWorkspace));+ $response = $this->actingAs($this->user)->post(route('app.workspaces.switch', $otherWorkspace));- $response->assertRedirect(route('calendar'));+ $response->assertRedirect(route('app.calendar'));$this->user->refresh();expect($this->user->current_workspace_id)->toBe($otherWorkspace->id);@@ -150,20 +150,20 @@ test('switch workspace returns 403 for workspace user does not belong to', funct$otherUser = User::factory()->create(['setup' => Setup::Completed]);$otherWorkspace = Workspace::factory()->create(['user_id' => $otherUser->id]);- $response = $this->actingAs($this->user)->post(route('workspaces.switch', $otherWorkspace));+ $response = $this->actingAs($this->user)->post(route('app.workspaces.switch', $otherWorkspace));$response->assertForbidden();});// Settings teststest('workspace settings requires authentication', function () {- $response = $this->get(route('workspace.settings'));+ $response = $this->get(route('app.workspace.settings'));$response->assertRedirect(route('login'));});test('workspace settings shows settings page', function () {- $response = $this->actingAs($this->user)->get(route('workspace.settings'));+ $response = $this->actingAs($this->user)->get(route('app.workspace.settings'));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -176,14 +176,14 @@ test('workspace settings shows settings page', function () {test('workspace settings redirects to create if no workspace', function () {$this->user->update(['current_workspace_id' => null]);- $response = $this->actingAs($this->user)->get(route('workspace.settings'));+ $response = $this->actingAs($this->user)->get(route('app.workspace.settings'));- $response->assertRedirect(route('workspaces.create'));+ $response->assertRedirect(route('app.workspaces.create'));});// Update settings teststest('update workspace settings requires authentication', function () {- $response = $this->put(route('workspace.settings.update'), [+ $response = $this->put(route('app.workspace.settings.update'), ['name' => 'Updated Name','timezone' => 'America/New_York',]);@@ -192,12 +192,12 @@ test('update workspace settings requires authentication', function () {});test('update workspace settings updates workspace', function () {- $response = $this->actingAs($this->user)->put(route('workspace.settings.update'), [+ $response = $this->actingAs($this->user)->put(route('app.workspace.settings.update'), ['name' => 'Updated Name','timezone' => 'America/New_York',]);- $response->assertRedirect(route('workspace.settings'));+ $response->assertRedirect(route('app.workspace.settings'));$this->workspace->refresh();expect($this->workspace->name)->toBe('Updated Name');@@ -205,7 +205,7 @@ test('update workspace settings updates workspace', function () {});test('update workspace settings validates required fields', function () {- $response = $this->actingAs($this->user)->put(route('workspace.settings.update'), [+ $response = $this->actingAs($this->user)->put(route('app.workspace.settings.update'), ['name' => '','timezone' => '',]);@@ -214,7 +214,7 @@ test('update workspace settings validates required fields', function () {});test('update workspace settings validates timezone', function () {- $response = $this->actingAs($this->user)->put(route('workspace.settings.update'), [+ $response = $this->actingAs($this->user)->put(route('app.workspace.settings.update'), ['name' => 'Valid Name','timezone' => 'Invalid/Timezone',]);@@ -224,7 +224,7 @@ test('update workspace settings validates timezone', function () {// Destroy teststest('destroy workspace requires authentication', function () {- $response = $this->delete(route('workspaces.destroy', $this->workspace));+ $response = $this->delete(route('app.workspaces.destroy', $this->workspace));$response->assertRedirect(route('login'));});@@ -232,14 +232,14 @@ test('destroy workspace requires authentication', function () {test('destroy workspace deletes the workspace', function () {$workspaceId = $this->workspace->id;- $response = $this->actingAs($this->user)->delete(route('workspaces.destroy', $this->workspace));+ $response = $this->actingAs($this->user)->delete(route('app.workspaces.destroy', $this->workspace));- $response->assertRedirect(route('workspaces.index'));+ $response->assertRedirect(route('app.workspaces.index'));expect(Workspace::find($workspaceId))->toBeNull();});test('destroy workspace clears current workspace if deleting current', function () {- $this->actingAs($this->user)->delete(route('workspaces.destroy', $this->workspace));+ $this->actingAs($this->user)->delete(route('app.workspaces.destroy', $this->workspace));$this->user->refresh();expect($this->user->current_workspace_id)->toBeNull();@@ -248,7 +248,7 @@ test('destroy workspace clears current workspace if deleting current', functiontest('destroy workspace returns 403 for non-owner', function () {$otherUser = User::factory()->create(['setup' => Setup::Completed]);- $response = $this->actingAs($otherUser)->delete(route('workspaces.destroy', $this->workspace));+ $response = $this->actingAs($otherUser)->delete(route('app.workspaces.destroy', $this->workspace));$response->assertForbidden();});diff --git a/tests/Feature/WorkspaceHashtagControllerTest.php b/tests/Feature/WorkspaceHashtagControllerTest.phpindex 54aca1312..3f41a79d1 100644--- a/tests/Feature/WorkspaceHashtagControllerTest.php+++ b/tests/Feature/WorkspaceHashtagControllerTest.php@@ -13,7 +13,7 @@ beforeEach(function () {// Index teststest('hashtags index requires authentication', function () {- $response = $this->get(route('hashtags.index'));+ $response = $this->get(route('app.hashtags.index'));$response->assertRedirect(route('login'));});@@ -21,7 +21,7 @@ test('hashtags index requires authentication', function () {test('hashtags index shows hashtags for workspace', function () {WorkspaceHashtag::factory()->count(3)->create(['workspace_id' => $this->workspace->id]);- $response = $this->actingAs($this->user)->get(route('hashtags.index'));+ $response = $this->actingAs($this->user)->get(route('app.hashtags.index'));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -34,14 +34,14 @@ test('hashtags index shows hashtags for workspace', function () {test('hashtags index redirects if no workspace', function () {$this->user->update(['current_workspace_id' => null]);- $response = $this->actingAs($this->user)->get(route('hashtags.index'));+ $response = $this->actingAs($this->user)->get(route('app.hashtags.index'));- $response->assertRedirect(route('workspaces.create'));+ $response->assertRedirect(route('app.workspaces.create'));});// Store teststest('store hashtag requires authentication', function () {- $response = $this->post(route('hashtags.store'), [+ $response = $this->post(route('app.hashtags.store'), ['name' => 'Marketing','hashtags' => '#marketing #digital #growth',]);@@ -50,12 +50,12 @@ test('store hashtag requires authentication', function () {});test('store hashtag creates hashtag group', function () {- $response = $this->actingAs($this->user)->post(route('hashtags.store'), [+ $response = $this->actingAs($this->user)->post(route('app.hashtags.store'), ['name' => 'Marketing','hashtags' => '#marketing #digital #growth',]);- $response->assertRedirect(route('hashtags.index'));+ $response->assertRedirect(route('app.hashtags.index'));$this->assertDatabaseHas('workspace_hashtags', ['workspace_id' => $this->workspace->id,@@ -65,7 +65,7 @@ test('store hashtag creates hashtag group', function () {});test('store hashtag validates required fields', function () {- $response = $this->actingAs($this->user)->post(route('hashtags.store'), [+ $response = $this->actingAs($this->user)->post(route('app.hashtags.store'), ['name' => '','hashtags' => '',]);@@ -77,7 +77,7 @@ test('store hashtag validates required fields', function () {test('update hashtag requires authentication', function () {$hashtag = WorkspaceHashtag::factory()->create(['workspace_id' => $this->workspace->id]);- $response = $this->put(route('hashtags.update', $hashtag), [+ $response = $this->put(route('app.hashtags.update', $hashtag), ['name' => 'Updated Name','hashtags' => '#updated #hashtags',]);@@ -88,12 +88,12 @@ test('update hashtag requires authentication', function () {test('update hashtag updates the hashtag group', function () {$hashtag = WorkspaceHashtag::factory()->create(['workspace_id' => $this->workspace->id]);- $response = $this->actingAs($this->user)->put(route('hashtags.update', $hashtag), [+ $response = $this->actingAs($this->user)->put(route('app.hashtags.update', $hashtag), ['name' => 'Updated Name','hashtags' => '#updated #hashtags',]);- $response->assertRedirect(route('hashtags.index'));+ $response->assertRedirect(route('app.hashtags.index'));$hashtag->refresh();expect($hashtag->name)->toBe('Updated Name');@@ -104,7 +104,7 @@ test('update hashtag returns 404 for other workspace hashtag', function () {$otherWorkspace = Workspace::factory()->create();$hashtag = WorkspaceHashtag::factory()->create(['workspace_id' => $otherWorkspace->id]);- $response = $this->actingAs($this->user)->put(route('hashtags.update', $hashtag), [+ $response = $this->actingAs($this->user)->put(route('app.hashtags.update', $hashtag), ['name' => 'Updated Name','hashtags' => '#updated #hashtags',]);@@ -116,7 +116,7 @@ test('update hashtag returns 404 for other workspace hashtag', function () {test('destroy hashtag requires authentication', function () {$hashtag = WorkspaceHashtag::factory()->create(['workspace_id' => $this->workspace->id]);- $response = $this->delete(route('hashtags.destroy', $hashtag));+ $response = $this->delete(route('app.hashtags.destroy', $hashtag));$response->assertRedirect(route('login'));});@@ -124,9 +124,9 @@ test('destroy hashtag requires authentication', function () {test('destroy hashtag deletes the hashtag group', function () {$hashtag = WorkspaceHashtag::factory()->create(['workspace_id' => $this->workspace->id]);- $response = $this->actingAs($this->user)->delete(route('hashtags.destroy', $hashtag));+ $response = $this->actingAs($this->user)->delete(route('app.hashtags.destroy', $hashtag));- $response->assertRedirect(route('hashtags.index'));+ $response->assertRedirect(route('app.hashtags.index'));expect(WorkspaceHashtag::find($hashtag->id))->toBeNull();});@@ -134,7 +134,7 @@ test('destroy hashtag returns 404 for other workspace hashtag', function () {$otherWorkspace = Workspace::factory()->create();$hashtag = WorkspaceHashtag::factory()->create(['workspace_id' => $otherWorkspace->id]);- $response = $this->actingAs($this->user)->delete(route('hashtags.destroy', $hashtag));+ $response = $this->actingAs($this->user)->delete(route('app.hashtags.destroy', $hashtag));$response->assertNotFound();});diff --git a/tests/Feature/WorkspaceInviteControllerTest.php b/tests/Feature/WorkspaceInviteControllerTest.phpindex a41977603..f68e71f40 100644--- a/tests/Feature/WorkspaceInviteControllerTest.php+++ b/tests/Feature/WorkspaceInviteControllerTest.php@@ -17,7 +17,7 @@ beforeEach(function () {// Index teststest('members index requires authentication', function () {- $response = $this->get(route('members'));+ $response = $this->get(route('app.members'));$response->assertRedirect(route('login'));});@@ -27,7 +27,7 @@ test('members index shows members and invites', function () {'workspace_id' => $this->workspace->id,]);- $response = $this->actingAs($this->user)->get(route('members'));+ $response = $this->actingAs($this->user)->get(route('app.members'));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -43,14 +43,14 @@ test('members index shows members and invites', function () {test('members index redirects if no workspace', function () {$this->user->update(['current_workspace_id' => null]);- $response = $this->actingAs($this->user)->get(route('members'));+ $response = $this->actingAs($this->user)->get(route('app.members'));- $response->assertRedirect(route('workspaces.create'));+ $response->assertRedirect(route('app.workspaces.create'));});// Store invite teststest('store invite requires authentication', function () {- $response = $this->post(route('invites.store'), [+ $response = $this->post(route('app.invites.store'), ['email' => '[email protected]','role' => WorkspaceRole::Member->value,]);@@ -59,7 +59,7 @@ test('store invite requires authentication', function () {});test('store invite creates invite and sends email', function () {- $response = $this->actingAs($this->user)->post(route('invites.store'), [+ $response = $this->actingAs($this->user)->post(route('app.invites.store'), ['email' => '[email protected]','role' => WorkspaceRole::Member->value,]);@@ -80,7 +80,7 @@ test('store invite fails if invite already exists', function () {'email' => '[email protected]',]);- $response = $this->actingAs($this->user)->post(route('invites.store'), [+ $response = $this->actingAs($this->user)->post(route('app.invites.store'), ['email' => '[email protected]','role' => WorkspaceRole::Member->value,]);@@ -92,7 +92,7 @@ test('store invite fails if user is already member', function () {$member = User::factory()->create(['setup' => Setup::Completed]);$this->workspace->members()->attach($member->id, ['role' => WorkspaceRole::Member->value]);- $response = $this->actingAs($this->user)->post(route('invites.store'), [+ $response = $this->actingAs($this->user)->post(route('app.invites.store'), ['email' => $member->email,'role' => WorkspaceRole::Member->value,]);@@ -106,7 +106,7 @@ test('destroy invite requires authentication', function () {'workspace_id' => $this->workspace->id,]);- $response = $this->delete(route('invites.destroy', $invite));+ $response = $this->delete(route('app.invites.destroy', $invite));$response->assertRedirect(route('login'));});@@ -116,7 +116,7 @@ test('destroy invite deletes invite', function () {'workspace_id' => $this->workspace->id,]);- $response = $this->actingAs($this->user)->delete(route('invites.destroy', $invite));+ $response = $this->actingAs($this->user)->delete(route('app.invites.destroy', $invite));$response->assertRedirect();expect(WorkspaceInvite::find($invite->id))->toBeNull();@@ -128,7 +128,7 @@ test('destroy invite returns 404 for other workspace invite', function () {'workspace_id' => $otherWorkspace->id,]);- $response = $this->actingAs($this->user)->delete(route('invites.destroy', $invite));+ $response = $this->actingAs($this->user)->delete(route('app.invites.destroy', $invite));$response->assertNotFound();});@@ -138,7 +138,7 @@ test('remove member requires authentication', function () {$member = User::factory()->create(['setup' => Setup::Completed]);$this->workspace->members()->attach($member->id, ['role' => WorkspaceRole::Member->value]);- $response = $this->delete(route('members.remove', $member));+ $response = $this->delete(route('app.members.remove', $member));$response->assertRedirect(route('login'));});@@ -147,14 +147,14 @@ test('remove member removes user from workspace', function () {$member = User::factory()->create(['setup' => Setup::Completed]);$this->workspace->members()->attach($member->id, ['role' => WorkspaceRole::Member->value]);- $response = $this->actingAs($this->user)->delete(route('members.remove', $member));+ $response = $this->actingAs($this->user)->delete(route('app.members.remove', $member));$response->assertRedirect();expect($this->workspace->hasMember($member))->toBeFalse();});test('remove member fails for owner', function () {- $response = $this->actingAs($this->user)->delete(route('members.remove', $this->user));+ $response = $this->actingAs($this->user)->delete(route('app.members.remove', $this->user));$response->assertSessionHasErrors('member');});diff --git a/tests/Feature/WorkspaceLabelControllerTest.php b/tests/Feature/WorkspaceLabelControllerTest.phpindex eb7151c85..3783d2c42 100644--- a/tests/Feature/WorkspaceLabelControllerTest.php+++ b/tests/Feature/WorkspaceLabelControllerTest.php@@ -13,7 +13,7 @@ beforeEach(function () {// Index teststest('labels index requires authentication', function () {- $response = $this->get(route('labels.index'));+ $response = $this->get(route('app.labels.index'));$response->assertRedirect(route('login'));});@@ -21,7 +21,7 @@ test('labels index requires authentication', function () {test('labels index shows labels for workspace', function () {WorkspaceLabel::factory()->count(3)->create(['workspace_id' => $this->workspace->id]);- $response = $this->actingAs($this->user)->get(route('labels.index'));+ $response = $this->actingAs($this->user)->get(route('app.labels.index'));$response->assertOk();$response->assertInertia(fn ($page) => $page@@ -34,14 +34,14 @@ test('labels index shows labels for workspace', function () {test('labels index redirects if no workspace', function () {$this->user->update(['current_workspace_id' => null]);- $response = $this->actingAs($this->user)->get(route('labels.index'));+ $response = $this->actingAs($this->user)->get(route('app.labels.index'));- $response->assertRedirect(route('workspaces.create'));+ $response->assertRedirect(route('app.workspaces.create'));});// Store teststest('store label requires authentication', function () {- $response = $this->post(route('labels.store'), [+ $response = $this->post(route('app.labels.store'), ['name' => 'Test Label','color' => '#FF5733',]);@@ -50,12 +50,12 @@ test('store label requires authentication', function () {});test('store label creates label', function () {- $response = $this->actingAs($this->user)->post(route('labels.store'), [+ $response = $this->actingAs($this->user)->post(route('app.labels.store'), ['name' => 'New Label','color' => '#FF5733',]);- $response->assertRedirect(route('labels.index'));+ $response->assertRedirect(route('app.labels.index'));$this->assertDatabaseHas('workspace_labels', ['workspace_id' => $this->workspace->id,@@ -65,7 +65,7 @@ test('store label creates label', function () {});test('store label validates required fields', function () {- $response = $this->actingAs($this->user)->post(route('labels.store'), [+ $response = $this->actingAs($this->user)->post(route('app.labels.store'), ['name' => '','color' => '',]);@@ -74,7 +74,7 @@ test('store label validates required fields', function () {});test('store label validates color format', function () {- $response = $this->actingAs($this->user)->post(route('labels.store'), [+ $response = $this->actingAs($this->user)->post(route('app.labels.store'), ['name' => 'Valid Name','color' => 'invalid-color',]);@@ -86,7 +86,7 @@ test('store label validates color format', function () {test('update label requires authentication', function () {$label = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id]);- $response = $this->put(route('labels.update', $label), [+ $response = $this->put(route('app.labels.update', $label), ['name' => 'Updated Label','color' => '#00FF00',]);@@ -97,12 +97,12 @@ test('update label requires authentication', function () {test('update label updates the label', function () {$label = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id]);- $response = $this->actingAs($this->user)->put(route('labels.update', $label), [+ $response = $this->actingAs($this->user)->put(route('app.labels.update', $label), ['name' => 'Updated Label','color' => '#00FF00',]);- $response->assertRedirect(route('labels.index'));+ $response->assertRedirect(route('app.labels.index'));$label->refresh();expect($label->name)->toBe('Updated Label');@@ -113,7 +113,7 @@ test('update label returns 404 for other workspace label', function () {$otherWorkspace = Workspace::factory()->create();$label = WorkspaceLabel::factory()->create(['workspace_id' => $otherWorkspace->id]);- $response = $this->actingAs($this->user)->put(route('labels.update', $label), [+ $response = $this->actingAs($this->user)->put(route('app.labels.update', $label), ['name' => 'Updated Label','color' => '#00FF00',]);@@ -125,7 +125,7 @@ test('update label returns 404 for other workspace label', function () {test('destroy label requires authentication', function () {$label = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id]);- $response = $this->delete(route('labels.destroy', $label));+ $response = $this->delete(route('app.labels.destroy', $label));$response->assertRedirect(route('login'));});@@ -133,9 +133,9 @@ test('destroy label requires authentication', function () {test('destroy label deletes the label', function () {$label = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id]);- $response = $this->actingAs($this->user)->delete(route('labels.destroy', $label));+ $response = $this->actingAs($this->user)->delete(route('app.labels.destroy', $label));- $response->assertRedirect(route('labels.index'));+ $response->assertRedirect(route('app.labels.index'));expect(WorkspaceLabel::find($label->id))->toBeNull();});@@ -143,7 +143,7 @@ test('destroy label returns 404 for other workspace label', function () {$otherWorkspace = Workspace::factory()->create();$label = WorkspaceLabel::factory()->create(['workspace_id' => $otherWorkspace->id]);- $response = $this->actingAs($this->user)->delete(route('labels.destroy', $label));+ $response = $this->actingAs($this->user)->delete(route('app.labels.destroy', $label));$response->assertNotFound();});diff --git a/tests/Pest.php b/tests/Pest.phpindex b3a25b735..f2e39978e 100644--- a/tests/Pest.php+++ b/tests/Pest.php@@ -1,5 +1,8 @@<?php+use Illuminate\Foundation\Testing\RefreshDatabase;+use Tests\TestCase;+/*|--------------------------------------------------------------------------| Test Case@@ -11,8 +14,8 @@|*/-pest()->extend(Tests\TestCase::class)- ->use(Illuminate\Foundation\Testing\RefreshDatabase::class)+pest()->extend(TestCase::class)+ ->use(RefreshDatabase::class)->in('Feature', 'Unit');/*diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.phpindex 27f3f877f..44a4f337a 100644--- a/tests/Unit/ExampleTest.php+++ b/tests/Unit/ExampleTest.php@@ -2,4 +2,4 @@test('that true is true', function () {expect(true)->toBeTrue();-});\ No newline at end of file+});diff --git a/tests/Unit/HelpersTest.php b/tests/Unit/HelpersTest.phpindex 3c9cb2a46..1c7dc27b5 100644--- a/tests/Unit/HelpersTest.php+++ b/tests/Unit/HelpersTest.php@@ -84,7 +84,7 @@ test('uploadFromUrl uses custom directory', function () {test('uploadFromUrl handles exceptions gracefully', function () {Http::fake(function () {- throw new \Exception('Network error');+ throw new Exception('Network error');});$result = uploadFromUrl('https://example.com/image.jpg');diff --git a/tests/Unit/Mail/AccountDisconnectedTest.php b/tests/Unit/Mail/AccountDisconnectedTest.phpindex c62e19778..3e9f6ffab 100644--- a/tests/Unit/Mail/AccountDisconnectedTest.php+++ b/tests/Unit/Mail/AccountDisconnectedTest.php@@ -4,6 +4,7 @@ use App\Enums\SocialAccount\Platform;use App\Mail\AccountDisconnected;use App\Models\SocialAccount;use App\Models\Workspace;+use Illuminate\Contracts\Queue\ShouldQueue;test('account disconnected mail has correct subject', function () {$workspace = Workspace::factory()->create(['name' => 'My Workspace']);@@ -36,7 +37,7 @@ test('account disconnected mail has correct content', function () {expect($content->with['platformName'])->toBe('LinkedIn');expect($content->with['accountName'])->toBe('John Doe');expect($content->with['workspaceName'])->toBe('Test Team');- expect($content->with['url'])->toBe(route('accounts'));+ expect($content->with['url'])->toBe(route('app.accounts'));});test('account disconnected mail uses username when display name is null', function () {@@ -64,5 +65,5 @@ test('account disconnected mail is queueable', function () {$mail = new AccountDisconnected($account);- expect($mail)->toBeInstanceOf(\Illuminate\Contracts\Queue\ShouldQueue::class);+ expect($mail)->toBeInstanceOf(ShouldQueue::class);});diff --git a/tests/Unit/Mail/WorkspaceInviteTest.php b/tests/Unit/Mail/WorkspaceInviteTest.phpindex d0b5492c3..7a9033296 100644--- a/tests/Unit/Mail/WorkspaceInviteTest.php+++ b/tests/Unit/Mail/WorkspaceInviteTest.php@@ -3,6 +3,7 @@use App\Mail\WorkspaceInvite;use App\Models\Workspace;use App\Models\WorkspaceInvite as WorkspaceInviteModel;+use Illuminate\Contracts\Queue\ShouldQueue;test('workspace invite mail has correct subject', function () {$workspace = Workspace::factory()->create(['name' => 'Test Workspace']);@@ -28,7 +29,7 @@ test('workspace invite mail has correct content', function () {expect($content->with['title'])->toBe("You've been invited to join My Team");expect($content->with['previewText'])->toBe("You've been invited to join My Team");expect($content->with['invite'])->toBe($invite);- expect($content->with['url'])->toBe(route('invites.show', $invite->id));+ expect($content->with['url'])->toBe(route('app.invites.show', $invite->id));});test('workspace invite mail has no attachments', function () {@@ -44,5 +45,5 @@ test('workspace invite mail is queueable', function () {$mail = new WorkspaceInvite($invite);- expect($mail)->toBeInstanceOf(\Illuminate\Contracts\Queue\ShouldQueue::class);+ expect($mail)->toBeInstanceOf(ShouldQueue::class);});diff --git a/tests/Unit/Models/MediaTest.php b/tests/Unit/Models/MediaTest.phpindex 85a513eec..e33f834ac 100644--- a/tests/Unit/Models/MediaTest.php+++ b/tests/Unit/Models/MediaTest.php@@ -1,7 +1,6 @@<?phpuse App\Enums\Media\Type as MediaType;-use App\Models\Media;use App\Models\Workspace;use Illuminate\Http\UploadedFile;use Illuminate\Support\Facades\Storage;diff --git a/tests/Unit/Services/InstagramPublisherTest.php b/tests/Unit/Services/InstagramPublisherTest.phpindex f83fbb0af..0fb244d8c 100644--- a/tests/Unit/Services/InstagramPublisherTest.php+++ b/tests/Unit/Services/InstagramPublisherTest.php@@ -32,7 +32,7 @@ test('instagram publisher throws exception when no media', function () {$publisher = new InstagramPublisher;expect(fn () => $publisher->publish($this->postPlatform))- ->toThrow(\Exception::class, 'Instagram requires at least one image or video.');+ ->toThrow(Exception::class, 'Instagram requires at least one image or video.');});test('instagram publisher publishes single image', function () {@@ -142,5 +142,5 @@ test('instagram publisher throws exception on api error', function () {$publisher = new InstagramPublisher;expect(fn () => $publisher->publish($this->postPlatform))- ->toThrow(\Exception::class);+ ->toThrow(Exception::class);});diff --git a/tests/Unit/Services/LinkedInPublisherTest.php b/tests/Unit/Services/LinkedInPublisherTest.phpindex 349a161a2..43b3820be 100644--- a/tests/Unit/Services/LinkedInPublisherTest.php+++ b/tests/Unit/Services/LinkedInPublisherTest.php@@ -9,7 +9,6 @@ use App\Models\SocialAccount;use App\Models\Workspace;use App\Services\Social\LinkedInPublisher;use Illuminate\Support\Facades\Http;-use Illuminate\Support\Facades\Storage;beforeEach(function () {$this->workspace = Workspace::factory()->create();@@ -47,7 +46,7 @@ test('linkedin publisher throws exception for carousel without images', function$publisher = new LinkedInPublisher;expect(fn () => $publisher->publish($this->postPlatform))- ->toThrow(\Exception::class, 'No valid images for LinkedIn carousel');+ ->toThrow(Exception::class, 'No valid images for LinkedIn carousel');});test('linkedin publisher throws token expired exception on oauth error', function () {@@ -138,7 +137,7 @@ test('linkedin publisher throws exception on api error', function () {$publisher = new LinkedInPublisher;expect(fn () => $publisher->publish($this->postPlatform))- ->toThrow(\Exception::class);+ ->toThrow(Exception::class);});test('linkedin publisher throws exception for unsupported content type', function () {@@ -147,7 +146,7 @@ test('linkedin publisher throws exception for unsupported content type', functio$publisher = new LinkedInPublisher;expect(fn () => $publisher->publish($this->postPlatform))- ->toThrow(\Exception::class, 'Unsupported LinkedIn content type');+ ->toThrow(Exception::class, 'Unsupported LinkedIn content type');});test('linkedin publisher handles 401 status as token error', function () {@@ -179,7 +178,7 @@ test('linkedin publisher handles token refresh failure', function () {$publisher = new LinkedInPublisher;expect(fn () => $publisher->publish($this->postPlatform))- ->toThrow(\Exception::class);+ ->toThrow(Exception::class);});test('linkedin publisher refreshes token when expiring soon', function () {diff --git a/tests/Unit/Services/Social/FacebookPublisherTest.php b/tests/Unit/Services/Social/FacebookPublisherTest.phpindex 8c567b1bc..b8786fcd3 100644--- a/tests/Unit/Services/Social/FacebookPublisherTest.php+++ b/tests/Unit/Services/Social/FacebookPublisherTest.php@@ -332,7 +332,7 @@ test('facebook publisher throws exception for text post with null content', func$this->postPlatform->update(['content' => null]);expect(fn () => $this->publisher->publish($this->postPlatform))- ->toThrow(\Exception::class, 'Facebook text posts require content');+ ->toThrow(Exception::class, 'Facebook text posts require content');});test('facebook publisher can publish single image with null content', function () {diff --git a/tests/Unit/Services/Social/InstagramPublisherTest.php b/tests/Unit/Services/Social/InstagramPublisherTest.phpindex aa93d95d0..76cc38a22 100644--- a/tests/Unit/Services/Social/InstagramPublisherTest.php+++ b/tests/Unit/Services/Social/InstagramPublisherTest.php@@ -40,7 +40,7 @@ beforeEach(function () {test('instagram publisher throws exception without media', function () {expect(fn () => $this->publisher->publish($this->postPlatform))- ->toThrow(\Exception::class, 'Instagram requires at least one image or video');+ ->toThrow(Exception::class, 'Instagram requires at least one image or video');});test('instagram publisher can publish single image', function () {diff --git a/tests/Unit/Services/Social/LinkedInTokenSynchronizerTest.php b/tests/Unit/Services/Social/LinkedInTokenSynchronizerTest.phpindex cf8b43dd9..6d5ba3015 100644--- a/tests/Unit/Services/Social/LinkedInTokenSynchronizerTest.php+++ b/tests/Unit/Services/Social/LinkedInTokenSynchronizerTest.php@@ -1,6 +1,5 @@<?php-use App\Enums\SocialAccount\Platform;use App\Enums\SocialAccount\Status;use App\Models\SocialAccount;use App\Models\User;diff --git a/tests/Unit/Services/Social/ThreadsPublisherTest.php b/tests/Unit/Services/Social/ThreadsPublisherTest.phpindex 4a996c71b..677ea3cdf 100644--- a/tests/Unit/Services/Social/ThreadsPublisherTest.php+++ b/tests/Unit/Services/Social/ThreadsPublisherTest.php@@ -297,7 +297,7 @@ test('threads publisher throws exception for text post with null content', funct$this->postPlatform->update(['content' => null]);expect(fn () => $this->publisher->publish($this->postPlatform))- ->toThrow(\Exception::class, 'Threads text posts require content');+ ->toThrow(Exception::class, 'Threads text posts require content');});test('threads publisher can publish image with null content', function () {diff --git a/tests/Unit/Services/Social/XPublisherTest.php b/tests/Unit/Services/Social/XPublisherTest.phpindex 19d39b7cf..31dc06a49 100644--- a/tests/Unit/Services/Social/XPublisherTest.php+++ b/tests/Unit/Services/Social/XPublisherTest.php@@ -160,14 +160,14 @@ test('x publisher throws exception with empty content and no media', function ()$this->postPlatform->update(['content' => '']);expect(fn () => $this->publisher->publish($this->postPlatform))- ->toThrow(\Exception::class, 'X posts require either text or media');+ ->toThrow(Exception::class, 'X posts require either text or media');});test('x publisher throws exception with null content and no media', function () {$this->postPlatform->update(['content' => null]);expect(fn () => $this->publisher->publish($this->postPlatform))- ->toThrow(\Exception::class, 'X posts require either text or media');+ ->toThrow(Exception::class, 'X posts require either text or media');});test('x publisher throws exception when no refresh token available', function () {diff --git a/tests/Unit/Services/Social/YouTubePublisherTest.php b/tests/Unit/Services/Social/YouTubePublisherTest.phpindex 00aca658f..65a61fed6 100644--- a/tests/Unit/Services/Social/YouTubePublisherTest.php+++ b/tests/Unit/Services/Social/YouTubePublisherTest.php@@ -86,7 +86,7 @@ test('youtube publisher refreshes token when expired', function () {try {$this->publisher->publish($this->postPlatform);- } catch (\Exception $e) {+ } catch (Exception $e) {// Expected to fail on upload, but token should be refreshed}@@ -159,5 +159,5 @@ test('youtube publisher throws exception with null content', function () {]);expect(fn () => $this->publisher->publish($this->postPlatform))- ->toThrow(\Exception::class, 'YouTube Shorts require a title');+ ->toThrow(Exception::class, 'YouTube Shorts require a title');});diff --git a/tests/Unit/Services/XPublisherTest.php b/tests/Unit/Services/XPublisherTest.phpindex dea9c474e..b19ae6a4f 100644--- a/tests/Unit/Services/XPublisherTest.php+++ b/tests/Unit/Services/XPublisherTest.php@@ -105,7 +105,7 @@ test('x publisher throws exception on api error', function () {$publisher = new XPublisher;expect(fn () => $publisher->publish($this->postPlatform))- ->toThrow(\Exception::class);+ ->toThrow(Exception::class);});test('x publisher returns unknown id when no id in response', function () {@@ -177,7 +177,7 @@ test('x publisher handles 403 error as generic error', function () {$publisher = new XPublisher;expect(fn () => $publisher->publish($this->postPlatform))- ->toThrow(\Exception::class, 'X API error');+ ->toThrow(Exception::class, 'X API error');});test('x publisher handles empty error response', function () {@@ -188,5 +188,5 @@ test('x publisher handles empty error response', function () {$publisher = new XPublisher;expect(fn () => $publisher->publish($this->postPlatform))- ->toThrow(\Exception::class);+ ->toThrow(Exception::class);});diff --git a/tests/Unit/Services/YouTubePublisherTest.php b/tests/Unit/Services/YouTubePublisherTest.phpindex 457fac195..25ff8a4b0 100644--- a/tests/Unit/Services/YouTubePublisherTest.php+++ b/tests/Unit/Services/YouTubePublisherTest.php@@ -33,7 +33,7 @@ test('youtube publisher throws exception when no media', function () {$publisher = new YouTubePublisher;expect(fn () => $publisher->publish($this->postPlatform))- ->toThrow(\Exception::class, 'YouTube Shorts requires a video to publish.');+ ->toThrow(Exception::class, 'YouTube Shorts requires a video to publish.');});test('youtube publisher throws exception for non video media', function () {@@ -46,7 +46,7 @@ test('youtube publisher throws exception for non video media', function () {$publisher = new YouTubePublisher;expect(fn () => $publisher->publish($this->postPlatform))- ->toThrow(\Exception::class, 'YouTube Shorts only supports video content.');+ ->toThrow(Exception::class, 'YouTube Shorts only supports video content.');});test('youtube publisher throws exception when no refresh token for expired token', function () {diff --git a/tests/Unit/Traits/HasMediaTest.php b/tests/Unit/Traits/HasMediaTest.phpindex 1a7b07cda..186991fd7 100644--- a/tests/Unit/Traits/HasMediaTest.php+++ b/tests/Unit/Traits/HasMediaTest.php@@ -4,6 +4,7 @@ use App\Models\Media;use App\Models\PostPlatform;use App\Models\User;use App\Models\Workspace;+use Illuminate\Database\Eloquent\Relations\MorphMany;use Illuminate\Http\UploadedFile;use Illuminate\Support\Facades\Storage;@@ -14,7 +15,7 @@ beforeEach(function () {test('model can get media relationship', function () {$workspace = Workspace::factory()->create();- expect($workspace->media())->toBeInstanceOf(\Illuminate\Database\Eloquent\Relations\MorphMany::class);+ expect($workspace->media())->toBeInstanceOf(MorphMany::class);});test('model can add media from uploaded file', function () {