diff --git a/.editorconfig b/.editorconfig index 546affff..0dede531 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,17 +5,23 @@ root = true # Unix-style newlines with a newline ending every file [*] -end_of_line = lf charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space insert_final_newline = true trim_trailing_whitespace = true -indent_style = space -indent_size = 4 # Tab indentation [Makefile] indent_style = tab tab_width = 4 -[yml] +[*.md] +trim_trailing_whitespace = false + +[*.{yml,yaml}] indent_size = 2 + +[docker-compose.yml] +indent_size = 4 diff --git a/app/Console/Commands/MigratePlaceDataFromPostgis.php b/app/Console/Commands/MigratePlaceDataFromPostgis.php index 9ce93a27..8d5d2c92 100644 --- a/app/Console/Commands/MigratePlaceDataFromPostgis.php +++ b/app/Console/Commands/MigratePlaceDataFromPostgis.php @@ -25,22 +25,10 @@ class MigratePlaceDataFromPostgis extends Command */ protected $description = 'Copy Postgis data to normal latitude longitude fields'; - /** - * Create a new command instance. - * - * @return void - */ - public function __construct() - { - parent::__construct(); - } - /** * Execute the console command. - * - * @return int */ - public function handle() + public function handle(): int { $locationColumn = DB::selectOne(DB::raw(" SELECT EXISTS ( diff --git a/app/Console/Commands/ParseCachedWebMentions.php b/app/Console/Commands/ParseCachedWebMentions.php index a7c0b8ca..07a6c662 100644 --- a/app/Console/Commands/ParseCachedWebMentions.php +++ b/app/Console/Commands/ParseCachedWebMentions.php @@ -6,6 +6,7 @@ namespace App\Console\Commands; use App\Models\WebMention; use Illuminate\Console\Command; +use Illuminate\Contracts\Filesystem\FileNotFoundException; use Illuminate\FileSystem\FileSystem; class ParseCachedWebMentions extends Command @@ -27,9 +28,9 @@ class ParseCachedWebMentions extends Command /** * Execute the console command. * - * @return mixed + * @throws FileNotFoundException */ - public function handle(FileSystem $filesystem) + public function handle(FileSystem $filesystem): void { $htmlFiles = $filesystem->allFiles(storage_path() . '/HTML'); foreach ($htmlFiles as $file) { @@ -49,8 +50,6 @@ class ParseCachedWebMentions extends Command /** * Determine the source URL from a filename. - * - * @param string */ private function urlFromFilename(string $filepath): string { diff --git a/app/Console/Commands/ReDownloadWebMentions.php b/app/Console/Commands/ReDownloadWebMentions.php index 2c5c18e0..c6452ba9 100644 --- a/app/Console/Commands/ReDownloadWebMentions.php +++ b/app/Console/Commands/ReDownloadWebMentions.php @@ -24,22 +24,10 @@ class ReDownloadWebMentions extends Command */ protected $description = 'Redownload the HTML content of webmentions'; - /** - * Create a new command instance. - * - * @return void - */ - public function __construct() - { - parent::__construct(); - } - /** * Execute the console command. - * - * @return mixed */ - public function handle() + public function handle(): void { $webmentions = WebMention::all(); foreach ($webmentions as $webmention) { diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 4ccc31e6..3ba67df6 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -10,7 +10,7 @@ class Kernel extends ConsoleKernel /** * The Artisan commands provided by your application. * - * @var array + * @var array */ protected $commands = [ Commands\ParseCachedWebMentions::class, @@ -20,11 +20,9 @@ class Kernel extends ConsoleKernel /** * Define the application's command schedule. * - * @return void - * * @codeCoverageIgnore */ - protected function schedule(Schedule $schedule) + protected function schedule(Schedule $schedule): void { $schedule->command('horizon:snapshot')->everyFiveMinutes(); $schedule->command('cache:prune-stale-tags')->hourly(); @@ -32,10 +30,8 @@ class Kernel extends ConsoleKernel /** * Register the commands for the application. - * - * @return void */ - protected function commands() + protected function commands(): void { $this->load(__DIR__ . '/Commands'); diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 30e8b3e1..1595d484 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -21,46 +21,34 @@ class Handler extends ExceptionHandler /** * A list of the exception types that are not reported. * - * @var array + * @var array> */ protected $dontReport = [ NotFoundHttpException::class, ModelNotFoundException::class, ]; - /** - * A list of the inputs that are never flashed for validation exceptions. - * - * @var array - */ - protected $dontFlash = [ - 'password', - 'password_confirmation', - ]; - /** * Report or log an exception. * * This is a great spot to send exceptions to Sentry, Bugsnag, etc. * - * @return void - * * @throws Exception * @throws Throwable */ - public function report(Throwable $throwable) + public function report(Throwable $e): void { - parent::report($throwable); + parent::report($e); - if (config('logging.slack') && $this->shouldReport($throwable)) { + if (config('logging.slack') && $this->shouldReport($e)) { $guzzle = new Client([ 'headers' => [ 'Content-Type' => 'application/json', ], ]); - $exceptionName = get_class($throwable) ?? 'Unknown Exception'; - $title = $exceptionName . ': ' . $throwable->getMessage(); + $exceptionName = get_class($e) ?? 'Unknown Exception'; + $title = $exceptionName . ': ' . $e->getMessage(); $guzzle->post( config('logging.slack'), diff --git a/app/Http/Controllers/ArticlesController.php b/app/Http/Controllers/ArticlesController.php index 5ca8a907..6ea4d1ed 100644 --- a/app/Http/Controllers/ArticlesController.php +++ b/app/Http/Controllers/ArticlesController.php @@ -27,10 +27,8 @@ class ArticlesController extends Controller /** * Show a single article. - * - * @return RedirectResponse|View */ - public function show(int $year, int $month, string $slug) + public function show(int $year, int $month, string $slug): RedirectResponse|View { try { $article = Article::where('titleurl', $slug)->firstOrFail(); @@ -49,8 +47,7 @@ class ArticlesController extends Controller } /** - * We only have the ID, work out post title, year and month - * and redirect to it. + * We only have the ID, work out post title, year and month and redirect to it. */ public function onlyIdInUrl(string $idFromUrl): RedirectResponse { diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index 01d91602..a37ce8fb 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace App\Http\Controllers; use Illuminate\Http\RedirectResponse; +use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\View\View; @@ -12,10 +13,8 @@ class AuthController extends Controller { /** * Show the login form. - * - * @return View|RedirectResponse */ - public function showLogin() + public function showLogin(): View|RedirectResponse { if (Auth::check()) { return redirect('/'); @@ -25,12 +24,11 @@ class AuthController extends Controller } /** - * Log in a user, set a session variable, check credentials against - * the .env file. + * Log in a user, set a session variable, check credentials against the `.env` file. */ - public function login(): RedirectResponse + public function login(Request $request): RedirectResponse { - $credentials = request()->only('name', 'password'); + $credentials = $request->only('name', 'password'); if (Auth::attempt($credentials, true)) { return redirect()->intended('/'); @@ -40,11 +38,9 @@ class AuthController extends Controller } /** - * Show the form to logout a user. - * - * @return View|RedirectResponse + * Show the form to allow a user to log-out. */ - public function showLogout() + public function showLogout(): View|RedirectResponse { if (Auth::check() === false) { // The user is not logged in, just redirect them home @@ -56,8 +52,6 @@ class AuthController extends Controller /** * Log the user out from their current session. - * - * @return RedirectResponse; */ public function logout(): RedirectResponse { diff --git a/app/Http/Controllers/FeedsController.php b/app/Http/Controllers/FeedsController.php index 16db9bfa..08c9a3ae 100644 --- a/app/Http/Controllers/FeedsController.php +++ b/app/Http/Controllers/FeedsController.php @@ -96,10 +96,8 @@ class FeedsController extends Controller /** * Returns the notes JSON feed. - * - * @return array */ - public function notesJson() + public function notesJson(): array { $notes = Note::latest()->with('media')->take(20)->get(); $data = [ diff --git a/app/Http/Controllers/FrontPageController.php b/app/Http/Controllers/FrontPageController.php index bcf82af4..9d37c9db 100644 --- a/app/Http/Controllers/FrontPageController.php +++ b/app/Http/Controllers/FrontPageController.php @@ -7,6 +7,7 @@ use App\Models\Bookmark; use App\Models\Like; use App\Models\Note; use App\Services\ActivityStreamsService; +use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\View\View; @@ -14,12 +15,10 @@ class FrontPageController extends Controller { /** * Show all the recent activity. - * - * @return Response|View */ - public function index() + public function index(Request $request): Response|View { - if (request()->wantsActivityStream()) { + if ($request->wantsActivityStream()) { return (new ActivityStreamsService())->siteOwnerResponse(); } diff --git a/app/Http/Controllers/MicropubController.php b/app/Http/Controllers/MicropubController.php index a667b560..1d1eccc3 100644 --- a/app/Http/Controllers/MicropubController.php +++ b/app/Http/Controllers/MicropubController.php @@ -115,34 +115,34 @@ class MicropubController extends Controller * appropriately. Further if the request has the query parameter * syndicate-to we respond with the known syndication endpoints. */ - public function get(): JsonResponse + public function get(Request $request): JsonResponse { try { - $tokenData = $this->tokenService->validateToken(request()->input('access_token')); + $tokenData = $this->tokenService->validateToken($request->input('access_token')); } catch (RequiredConstraintsViolated|InvalidTokenStructure) { return (new MicropubResponses())->invalidTokenResponse(); } - if (request()->input('q') === 'syndicate-to') { + if ($request->input('q') === 'syndicate-to') { return response()->json([ 'syndicate-to' => SyndicationTarget::all(), ]); } - if (request()->input('q') === 'config') { + if ($request->input('q') === 'config') { return response()->json([ 'syndicate-to' => SyndicationTarget::all(), 'media-endpoint' => route('media-endpoint'), ]); } - if (request()->has('q') && substr(request()->input('q'), 0, 4) === 'geo:') { + if ($request->has('q') && str_starts_with($request->input('q'), 'geo:')) { preg_match_all( '/([0-9.\-]+)/', - request()->input('q'), + $request->input('q'), $matches ); - $distance = (count($matches[0]) == 3) ? 100 * $matches[0][2] : 1000; + $distance = (count($matches[0]) === 3) ? 100 * $matches[0][2] : 1000; $places = Place::near( (object) ['latitude' => $matches[0][0], 'longitude' => $matches[0][1]], $distance @@ -168,22 +168,19 @@ class MicropubController extends Controller /** * Determine the client id from the access token sent with the request. * - * * @throws RequiredConstraintsViolated */ private function getClientId(): string { return resolve(TokenService::class) - ->validateToken(request()->input('access_token')) + ->validateToken(app('request')->input('access_token')) ->claims()->get('client_id'); } /** * Save the details of the micropub request to a log file. - * - * @param array $request This is the info from request()->all() */ - private function logMicropubRequest(array $request) + private function logMicropubRequest(array $request): void { $logger = new Logger('micropub'); $logger->pushHandler(new StreamHandler(storage_path('logs/micropub.log'))); diff --git a/app/Http/Controllers/MicropubMediaController.php b/app/Http/Controllers/MicropubMediaController.php index f79928dd..acd8ad0d 100644 --- a/app/Http/Controllers/MicropubMediaController.php +++ b/app/Http/Controllers/MicropubMediaController.php @@ -98,14 +98,13 @@ class MicropubMediaController extends Controller /** * Process a media item posted to the media endpoint. * - * * @throws BindingResolutionException * @throws Exception */ - public function media(): JsonResponse + public function media(Request $request): JsonResponse { try { - $tokenData = $this->tokenService->validateToken(request()->input('access_token')); + $tokenData = $this->tokenService->validateToken($request->input('access_token')); } catch (RequiredConstraintsViolated|InvalidTokenStructure $exception) { $micropubResponses = new MicropubResponses(); @@ -124,7 +123,7 @@ class MicropubMediaController extends Controller return $micropubResponses->insufficientScopeResponse(); } - if (request()->hasFile('file') === false) { + if ($request->hasFile('file') === false) { return response()->json([ 'response' => 'error', 'error' => 'invalid_request', @@ -132,7 +131,7 @@ class MicropubMediaController extends Controller ], 400); } - if (request()->file('file')->isValid() === false) { + if ($request->file('file')->isValid() === false) { return response()->json([ 'response' => 'error', 'error' => 'invalid_request', @@ -140,11 +139,11 @@ class MicropubMediaController extends Controller ], 400); } - $filename = $this->saveFile(request()->file('file')); + $filename = $this->saveFile($request->file('file')); $manager = resolve(ImageManager::class); try { - $image = $manager->make(request()->file('file')); + $image = $manager->make($request->file('file')); $width = $image->width(); } catch (NotReadableException $exception) { // not an image @@ -152,9 +151,9 @@ class MicropubMediaController extends Controller } $media = Media::create([ - 'token' => request()->bearerToken(), + 'token' => $request->bearerToken(), 'path' => 'media/' . $filename, - 'type' => $this->getFileTypeFromMimeType(request()->file('file')->getMimeType()), + 'type' => $this->getFileTypeFromMimeType($request->file('file')->getMimeType()), 'image_widths' => $width, ]); @@ -226,7 +225,6 @@ class MicropubMediaController extends Controller /** * Save an uploaded file to the local disk. * - * * @throws Exception */ private function saveFile(UploadedFile $file): string diff --git a/app/Http/Controllers/NotesController.php b/app/Http/Controllers/NotesController.php index 543b6158..aea2bd76 100644 --- a/app/Http/Controllers/NotesController.php +++ b/app/Http/Controllers/NotesController.php @@ -9,6 +9,7 @@ use App\Services\ActivityStreamsService; use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Http\JsonResponse; use Illuminate\Http\RedirectResponse; +use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\View\View; use Jonnybarnes\IndieWeb\Numbers; @@ -19,12 +20,10 @@ class NotesController extends Controller { /** * Show all the notes. This is also the homepage. - * - * @return View|Response */ - public function index() + public function index(Request $request): View|Response { - if (request()->wantsActivityStream()) { + if ($request->wantsActivityStream()) { return (new ActivityStreamsService())->siteOwnerResponse(); } @@ -39,11 +38,8 @@ class NotesController extends Controller /** * Show a single note. - * - * @param string $urlId The id of the note - * @return View|JsonResponse|Response */ - public function show(string $urlId) + public function show(string $urlId): View|JsonResponse|Response { try { $note = Note::nb60($urlId)->with('webmentions')->firstOrFail(); @@ -60,8 +56,6 @@ class NotesController extends Controller /** * Redirect /note/{decID} to /notes/{nb60id}. - * - * @param int $decId The decimal id of the note */ public function redirect(int $decId): RedirectResponse { diff --git a/app/Http/Controllers/ShortURLsController.php b/app/Http/Controllers/ShortURLsController.php index 440d79f7..ae8128f0 100644 --- a/app/Http/Controllers/ShortURLsController.php +++ b/app/Http/Controllers/ShortURLsController.php @@ -35,17 +35,15 @@ class ShortURLsController extends Controller /** * Redirect a short url of this site out to a long one based on post type. - * Further redirects may happen. * - * @param string Post type - * @param string Post ID + * Further redirects may happen. */ public function expandType(string $type, string $postId): RedirectResponse { - if ($type == 't') { + if ($type === 't') { $type = 'notes'; } - if ($type == 'b') { + if ($type === 'b') { $type = 'blog/s'; } diff --git a/app/Http/Controllers/TokenEndpointController.php b/app/Http/Controllers/TokenEndpointController.php index 06fa15df..73e86deb 100644 --- a/app/Http/Controllers/TokenEndpointController.php +++ b/app/Http/Controllers/TokenEndpointController.php @@ -24,9 +24,6 @@ class TokenEndpointController extends Controller */ protected GuzzleClient $guzzle; - /** - * @var TokenService The Token handling service. - */ protected TokenService $tokenService; /** diff --git a/app/Http/Controllers/WebMentionsController.php b/app/Http/Controllers/WebMentionsController.php index f5626742..b6c4a71b 100644 --- a/app/Http/Controllers/WebMentionsController.php +++ b/app/Http/Controllers/WebMentionsController.php @@ -7,6 +7,7 @@ namespace App\Http\Controllers; use App\Jobs\ProcessWebMention; use App\Models\Note; use Illuminate\Database\Eloquent\ModelNotFoundException; +use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\View\View; use Jonnybarnes\IndieWeb\Numbers; @@ -27,10 +28,10 @@ class WebMentionsController extends Controller /** * Receive and process a webmention. */ - public function receive(): Response + public function receive(Request $request): Response { //first we trivially reject requests that lack all required inputs - if ((request()->has('target') !== true) || (request()->has('source') !== true)) { + if (($request->has('target') !== true) || ($request->has('source') !== true)) { return response( 'You need both the target and source parameters', 400 @@ -38,15 +39,15 @@ class WebMentionsController extends Controller } //next check the $target is valid - $path = parse_url(request()->input('target'), PHP_URL_PATH); + $path = parse_url($request->input('target'), PHP_URL_PATH); $pathParts = explode('/', $path); - if ($pathParts[1] == 'notes') { + if ($pathParts[1] === 'notes') { //we have a note $noteId = $pathParts[2]; try { $note = Note::findOrFail(resolve(Numbers::class)->b60tonum($noteId)); - dispatch(new ProcessWebMention($note, request()->input('source'))); + dispatch(new ProcessWebMention($note, $request->input('source'))); } catch (ModelNotFoundException $e) { return response('This note doesn’t exist.', 400); } @@ -56,7 +57,7 @@ class WebMentionsController extends Controller 202 ); } - if ($pathParts[1] == 'blog') { + if ($pathParts[1] === 'blog') { return response( 'I don’t accept webmentions for blog posts yet.', 501 diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 8fb91153..d2be1cb7 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -11,7 +11,7 @@ class Kernel extends HttpKernel * * These middleware are run during every request to your application. * - * @var array + * @var array */ protected $middleware = [ // \App\Http\Middleware\TrustHosts::class, @@ -26,7 +26,7 @@ class Kernel extends HttpKernel /** * The application's route middleware groups. * - * @var array + * @var array> */ protected $middlewareGroups = [ 'web' => [ @@ -44,21 +44,23 @@ class Kernel extends HttpKernel ], 'api' => [ - 'throttle:api', + // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, + \Illuminate\Routing\Middleware\ThrottleRequests::class.':api', \Illuminate\Routing\Middleware\SubstituteBindings::class, ], ]; /** - * The application's route middleware. + * The application's middleware aliases. * - * These middleware may be assigned to groups or used individually. + * Aliases may be used to conveniently assign middleware to routes and groups. * - * @var array + * @var array */ protected $middlewareAliases = [ 'auth' => \App\Http\Middleware\Authenticate::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, + 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 'can' => \Illuminate\Auth\Middleware\Authorize::class, 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, diff --git a/app/Http/Middleware/ActivityStreamLinks.php b/app/Http/Middleware/ActivityStreamLinks.php index 298865b4..47727d98 100644 --- a/app/Http/Middleware/ActivityStreamLinks.php +++ b/app/Http/Middleware/ActivityStreamLinks.php @@ -6,15 +6,14 @@ namespace App\Http\Middleware; use Closure; use Illuminate\Http\Request; +use Symfony\Component\HttpFoundation\Response; class ActivityStreamLinks { /** * Handle an incoming request. - * - * @return mixed */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): Response { $response = $next($request); if ($request->path() === '/') { diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index 81e6fd40..624cd371 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -3,6 +3,7 @@ namespace App\Http\Middleware; use Illuminate\Auth\Middleware\Authenticate as Middleware; +use Illuminate\Http\Request; /** * @codeCoverageIgnore @@ -11,14 +12,9 @@ class Authenticate extends Middleware { /** * Get the path the user should be redirected to when they are not authenticated. - * - * @param \Illuminate\Http\Request $request - * @return string */ - protected function redirectTo($request) + protected function redirectTo(Request $request): ?string { - if (! $request->expectsJson()) { - return route('login'); - } + return $request->expectsJson() ? null : route('login'); } } diff --git a/app/Http/Middleware/CSPHeader.php b/app/Http/Middleware/CSPHeader.php index 0e8a9d87..07e77e3a 100644 --- a/app/Http/Middleware/CSPHeader.php +++ b/app/Http/Middleware/CSPHeader.php @@ -5,16 +5,14 @@ namespace App\Http\Middleware; use Closure; use Illuminate\Http\Request; use Illuminate\Support\Facades\App; +use Symfony\Component\HttpFoundation\Response; class CSPHeader { /** * Handle an incoming request. - * - * @param Request $request - * @return mixed */ - public function handle($request, Closure $next) + public function handle(Request $request, Closure $next): Response { if (App::environment('local', 'development')) { return $next($request); diff --git a/app/Http/Middleware/CheckForMaintenanceMode.php b/app/Http/Middleware/CheckForMaintenanceMode.php deleted file mode 100644 index 35b9824b..00000000 --- a/app/Http/Middleware/CheckForMaintenanceMode.php +++ /dev/null @@ -1,17 +0,0 @@ -path() === 'api/media') { diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php index 033136ad..867695bd 100644 --- a/app/Http/Middleware/EncryptCookies.php +++ b/app/Http/Middleware/EncryptCookies.php @@ -9,7 +9,7 @@ class EncryptCookies extends Middleware /** * The names of the cookies that should not be encrypted. * - * @var array + * @var array */ protected $except = [ // diff --git a/app/Http/Middleware/LinkHeadersMiddleware.php b/app/Http/Middleware/LinkHeadersMiddleware.php index bb0422f7..d2a1b4f6 100644 --- a/app/Http/Middleware/LinkHeadersMiddleware.php +++ b/app/Http/Middleware/LinkHeadersMiddleware.php @@ -3,16 +3,15 @@ namespace App\Http\Middleware; use Closure; +use Illuminate\Http\Request; +use Symfony\Component\HttpFoundation\Response; class LinkHeadersMiddleware { /** * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @return mixed */ - public function handle($request, Closure $next) + public function handle(Request $request, Closure $next): Response { $response = $next($request); $response->header('Link', '; rel="authorization_endpoint"', false); diff --git a/app/Http/Middleware/LocalhostSessionMiddleware.php b/app/Http/Middleware/LocalhostSessionMiddleware.php index a8e84455..060682d5 100644 --- a/app/Http/Middleware/LocalhostSessionMiddleware.php +++ b/app/Http/Middleware/LocalhostSessionMiddleware.php @@ -6,6 +6,7 @@ namespace App\Http\Middleware; use Closure; use Illuminate\Http\Request; +use Symfony\Component\HttpFoundation\Response; class LocalhostSessionMiddleware { @@ -13,10 +14,8 @@ class LocalhostSessionMiddleware * Whilst we are developing locally, automatically log in as * `['me' => config('app.url')]` as I can’t manually log in as * a .localhost domain. - * - * @return mixed */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): Response { if (config('app.env') !== 'production') { session(['me' => config('app.url')]); diff --git a/app/Http/Middleware/MyAuthMiddleware.php b/app/Http/Middleware/MyAuthMiddleware.php index c4f9da6f..57d0bfa3 100644 --- a/app/Http/Middleware/MyAuthMiddleware.php +++ b/app/Http/Middleware/MyAuthMiddleware.php @@ -7,18 +7,17 @@ namespace App\Http\Middleware; use Closure; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use Symfony\Component\HttpFoundation\Response; class MyAuthMiddleware { /** * Check the user is logged in. - * - * @return mixed */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): Response { - if (Auth::check($request->user()) == false) { - //they’re not logged in, so send them to login form + if (Auth::check() === false) { + // they’re not logged in, so send them to login form return redirect()->route('login'); } diff --git a/app/Http/Middleware/PreventRequestsDuringMaintenance.php b/app/Http/Middleware/PreventRequestsDuringMaintenance.php index e4956d0b..74cbd9a9 100644 --- a/app/Http/Middleware/PreventRequestsDuringMaintenance.php +++ b/app/Http/Middleware/PreventRequestsDuringMaintenance.php @@ -9,7 +9,7 @@ class PreventRequestsDuringMaintenance extends Middleware /** * The URIs that should be reachable while maintenance mode is enabled. * - * @var array + * @var array */ protected $except = [ // diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index f15a8dab..a6a6c8c4 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -6,6 +6,7 @@ use App\Providers\RouteServiceProvider; use Closure; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use Symfony\Component\HttpFoundation\Response; /** * @codeCoverageIgnore @@ -15,10 +16,9 @@ class RedirectIfAuthenticated /** * Handle an incoming request. * - * @param string|null ...$guards - * @return mixed + * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next */ - public function handle(Request $request, Closure $next, ...$guards) + public function handle(Request $request, Closure $next, string ...$guards): Response { $guards = empty($guards) ? [null] : $guards; diff --git a/app/Http/Middleware/TrimStrings.php b/app/Http/Middleware/TrimStrings.php index 5a50e7b5..88cadcaa 100644 --- a/app/Http/Middleware/TrimStrings.php +++ b/app/Http/Middleware/TrimStrings.php @@ -9,9 +9,10 @@ class TrimStrings extends Middleware /** * The names of the attributes that should not be trimmed. * - * @var array + * @var array */ protected $except = [ + 'current_password', 'password', 'password_confirmation', ]; diff --git a/app/Http/Middleware/TrustHosts.php b/app/Http/Middleware/TrustHosts.php index 79426404..9c88c34c 100644 --- a/app/Http/Middleware/TrustHosts.php +++ b/app/Http/Middleware/TrustHosts.php @@ -12,9 +12,9 @@ class TrustHosts extends Middleware /** * Get the host patterns that should be trusted. * - * @return array + * @return array */ - public function hosts() + public function hosts(): array { return [ $this->allSubdomainsOfApplicationUrl(), diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php index d5563e69..f33f3eef 100644 --- a/app/Http/Middleware/TrustProxies.php +++ b/app/Http/Middleware/TrustProxies.php @@ -10,7 +10,7 @@ class TrustProxies extends Middleware /** * The trusted proxies for this application. * - * @var array|string + * @var array|string|null */ protected $proxies; diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php index 1593e373..fc7bad50 100644 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ b/app/Http/Middleware/VerifyCsrfToken.php @@ -9,7 +9,7 @@ class VerifyCsrfToken extends Middleware /** * The URIs that should be excluded from CSRF verification. * - * @var array + * @var array */ protected $except = [ 'api/media', diff --git a/app/Http/Middleware/VerifyMicropubToken.php b/app/Http/Middleware/VerifyMicropubToken.php index b868239e..813350cf 100644 --- a/app/Http/Middleware/VerifyMicropubToken.php +++ b/app/Http/Middleware/VerifyMicropubToken.php @@ -6,15 +6,14 @@ namespace App\Http\Middleware; use Closure; use Illuminate\Http\Request; +use Symfony\Component\HttpFoundation\Response; class VerifyMicropubToken { /** * Handle an incoming request. - * - * @return mixed */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): Response { if ($request->input('access_token')) { return $next($request); diff --git a/app/Jobs/AddClientToDatabase.php b/app/Jobs/AddClientToDatabase.php index de3d12ee..b540aac0 100644 --- a/app/Jobs/AddClientToDatabase.php +++ b/app/Jobs/AddClientToDatabase.php @@ -18,24 +18,22 @@ class AddClientToDatabase implements ShouldQueue use Queueable; use SerializesModels; - protected $client_id; + protected string $client_id; /** * Create a new job instance. */ - public function __construct(string $client_id) + public function __construct(string $clientId) { - $this->client_id = $client_id; + $this->client_id = $clientId; } /** * Execute the job. - * - * @return void */ - public function handle() + public function handle(): void { - if (MicropubClient::where('client_url', $this->client_id)->count() == 0) { + if (MicropubClient::where('client_url', $this->client_id)->count() === 0) { MicropubClient::create([ 'client_url' => $this->client_id, 'client_name' => $this->client_id, // default client name is the URL diff --git a/app/Jobs/DownloadWebMention.php b/app/Jobs/DownloadWebMention.php index ff2342d2..72f469e5 100644 --- a/app/Jobs/DownloadWebMention.php +++ b/app/Jobs/DownloadWebMention.php @@ -19,34 +19,26 @@ class DownloadWebMention implements ShouldQueue use Queueable; use SerializesModels; - /** - * The webmention source URL. - * - * @var string - */ - protected $source; - /** * Create a new job instance. */ - public function __construct(string $source) - { - $this->source = $source; + public function __construct( + protected string $source + ) { } /** * Execute the job. * - * * @throws GuzzleException * @throws FileNotFoundException */ - public function handle(Client $guzzle) + public function handle(Client $guzzle): void { $response = $guzzle->request('GET', $this->source); //4XX and 5XX responses should get Guzzle to throw an exception, //Laravel should catch and retry these automatically. - if ($response->getStatusCode() == '200') { + if ($response->getStatusCode() === 200) { $filesystem = new FileSystem(); $filename = storage_path('HTML') . '/' . $this->createFilenameFromURL($this->source); //backup file first @@ -69,7 +61,7 @@ class DownloadWebMention implements ShouldQueue ); //remove backup if the same if ($filesystem->exists($filenameBackup)) { - if ($filesystem->get($filename) == $filesystem->get($filenameBackup)) { + if ($filesystem->get($filename) === $filesystem->get($filenameBackup)) { $filesystem->delete($filenameBackup); } } @@ -78,13 +70,11 @@ class DownloadWebMention implements ShouldQueue /** * Create a file path from a URL. This is used when caching the HTML response. - * - * @return string The path name */ - private function createFilenameFromURL(string $url) + private function createFilenameFromURL(string $url): string { $filepath = str_replace(['https://', 'http://'], ['https/', 'http/'], $url); - if (substr($filepath, -1) == '/') { + if (str_ends_with($filepath, '/')) { $filepath .= 'index.html'; } diff --git a/app/Jobs/ProcessBookmark.php b/app/Jobs/ProcessBookmark.php index cdbca8a2..b1dffe8a 100644 --- a/app/Jobs/ProcessBookmark.php +++ b/app/Jobs/ProcessBookmark.php @@ -20,14 +20,12 @@ class ProcessBookmark implements ShouldQueue use Queueable; use SerializesModels; - protected Bookmark $bookmark; - /** * Create a new job instance. */ - public function __construct(Bookmark $bookmark) - { - $this->bookmark = $bookmark; + public function __construct( + protected Bookmark $bookmark + ) { } /** diff --git a/app/Jobs/ProcessLike.php b/app/Jobs/ProcessLike.php index cafe156d..3a2d6f62 100644 --- a/app/Jobs/ProcessLike.php +++ b/app/Jobs/ProcessLike.php @@ -25,21 +25,17 @@ class ProcessLike implements ShouldQueue use Queueable; use SerializesModels; - /** @var Like */ - protected $like; - /** * Create a new job instance. */ - public function __construct(Like $like) - { - $this->like = $like; + public function __construct( + protected Like $like + ) { } /** * Execute the job. * - * * @throws GuzzleException */ public function handle(Client $client, Authorship $authorship): int diff --git a/app/Jobs/ProcessMedia.php b/app/Jobs/ProcessMedia.php index 8ce127b0..f35bdd1a 100644 --- a/app/Jobs/ProcessMedia.php +++ b/app/Jobs/ProcessMedia.php @@ -20,21 +20,18 @@ class ProcessMedia implements ShouldQueue use Queueable; use SerializesModels; - /** @var string */ - protected $filename; - /** * Create a new job instance. */ - public function __construct(string $filename) - { - $this->filename = $filename; + public function __construct( + protected string $filename + ) { } /** * Execute the job. */ - public function handle(ImageManager $manager) + public function handle(ImageManager $manager): void { //open file try { diff --git a/app/Jobs/ProcessWebMention.php b/app/Jobs/ProcessWebMention.php index 55f35b75..21305fe4 100644 --- a/app/Jobs/ProcessWebMention.php +++ b/app/Jobs/ProcessWebMention.php @@ -24,30 +24,23 @@ class ProcessWebMention implements ShouldQueue use Queueable; use SerializesModels; - /** @var Note */ - protected $note; - - /** @var string */ - protected $source; - /** * Create a new job instance. */ - public function __construct(Note $note, string $source) - { - $this->note = $note; - $this->source = $source; + public function __construct( + protected Note $note, + protected string $source + ) { } /** * Execute the job. * - * * @throws RemoteContentNotFoundException * @throws GuzzleException * @throws InvalidMentionException */ - public function handle(Parser $parser, Client $guzzle) + public function handle(Parser $parser, Client $guzzle): void { try { $response = $guzzle->request('GET', $this->source); @@ -60,8 +53,8 @@ class ProcessWebMention implements ShouldQueue foreach ($webmentions as $webmention) { // check webmention still references target // we try each type of mention (reply/like/repost) - if ($webmention->type == 'in-reply-to') { - if ($parser->checkInReplyTo($microformats, $this->note->longurl) == false) { + if ($webmention->type === 'in-reply-to') { + if ($parser->checkInReplyTo($microformats, $this->note->longurl) === false) { // it doesn’t so delete $webmention->delete(); @@ -74,16 +67,16 @@ class ProcessWebMention implements ShouldQueue return; } - if ($webmention->type == 'like-of') { - if ($parser->checkLikeOf($microformats, $this->note->longurl) == false) { + if ($webmention->type === 'like-of') { + if ($parser->checkLikeOf($microformats, $this->note->longurl) === false) { // it doesn’t so delete $webmention->delete(); return; } // note we don’t need to do anything if it still is a like } - if ($webmention->type == 'repost-of') { - if ($parser->checkRepostOf($microformats, $this->note->longurl) == false) { + if ($webmention->type === 'repost-of') { + if ($parser->checkRepostOf($microformats, $this->note->longurl) === false) { // it doesn’t so delete $webmention->delete(); @@ -107,26 +100,23 @@ class ProcessWebMention implements ShouldQueue /** * Save the HTML of a webmention for future use. - * - * @param string $html - * @param string $url */ - private function saveRemoteContent($html, $url) + private function saveRemoteContent(string $html, string $url): void { $filenameFromURL = str_replace( ['https://', 'http://'], ['https/', 'http/'], $url ); - if (substr($url, -1) == '/') { + if (str_ends_with($url, '/')) { $filenameFromURL .= 'index.html'; } $path = storage_path() . '/HTML/' . $filenameFromURL; $parts = explode('/', $path); $name = array_pop($parts); $dir = implode('/', $parts); - if (! is_dir($dir)) { - mkdir($dir, 0755, true); + if (! is_dir($dir) && ! mkdir($dir, 0755, true) && !is_dir($dir)) { + throw new \RuntimeException(sprintf('Directory "%s" was not created', $dir)); } file_put_contents("$dir/$name", $html); } diff --git a/app/Jobs/SaveProfileImage.php b/app/Jobs/SaveProfileImage.php index 8535d8c9..e133a365 100644 --- a/app/Jobs/SaveProfileImage.php +++ b/app/Jobs/SaveProfileImage.php @@ -20,25 +20,23 @@ class SaveProfileImage implements ShouldQueue use Queueable; use SerializesModels; - protected array $microformats; - /** * Create a new job instance. */ - public function __construct(array $microformats) - { - $this->microformats = $microformats; + public function __construct( + protected array $microformats + ) { } /** * Execute the job. */ - public function handle(Authorship $authorship) + public function handle(Authorship $authorship): void { try { $author = $authorship->findAuthor($this->microformats); } catch (AuthorshipParserException) { - return null; + return; } $photo = Arr::get($author, 'properties.photo.0'); @@ -47,8 +45,8 @@ class SaveProfileImage implements ShouldQueue //dont save pbs.twimg.com links if ( $photo - && parse_url($photo, PHP_URL_HOST) != 'pbs.twimg.com' - && parse_url($photo, PHP_URL_HOST) != 'twitter.com' + && parse_url($photo, PHP_URL_HOST) !== 'pbs.twimg.com' + && parse_url($photo, PHP_URL_HOST) !== 'twitter.com' ) { $client = resolve(Client::class); @@ -67,8 +65,8 @@ class SaveProfileImage implements ShouldQueue $parts = explode('/', $path); $name = array_pop($parts); $dir = implode('/', $parts); - if (! is_dir($dir)) { - mkdir($dir, 0755, true); + if (! is_dir($dir) && ! mkdir($dir, 0755, true) && !is_dir($dir)) { + throw new \RuntimeException(sprintf('Directory "%s" was not created', $dir)); } file_put_contents("$dir/$name", $image); } diff --git a/app/Jobs/SaveScreenshot.php b/app/Jobs/SaveScreenshot.php index 74e37305..c086276c 100755 --- a/app/Jobs/SaveScreenshot.php +++ b/app/Jobs/SaveScreenshot.php @@ -18,16 +18,12 @@ class SaveScreenshot implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - private Bookmark $bookmark; - /** * Create a new job instance. - * - * @return void */ - public function __construct(Bookmark $bookmark) - { - $this->bookmark = $bookmark; + public function __construct( + protected Bookmark $bookmark + ) { } /** diff --git a/app/Jobs/SendWebMentions.php b/app/Jobs/SendWebMentions.php index 153c33ee..b481f69d 100644 --- a/app/Jobs/SendWebMentions.php +++ b/app/Jobs/SendWebMentions.php @@ -22,20 +22,17 @@ class SendWebMentions implements ShouldQueue use Queueable; use SerializesModels; - protected Note $note; - /** - * Create the job instance, inject dependencies. + * Create a new job instance. */ - public function __construct(Note $note) - { - $this->note = $note; + public function __construct( + protected Note $note + ) { } /** * Execute the job. * - * * @throws GuzzleException */ public function handle(): void @@ -60,7 +57,6 @@ class SendWebMentions implements ShouldQueue /** * Discover if a URL has a webmention endpoint. * - * * @throws GuzzleException */ public function discoverWebmentionEndpoint(string $url): ?string @@ -126,8 +122,6 @@ class SendWebMentions implements ShouldQueue /** * Resolve a URI if necessary. - * - * @param string $base The base of the URL */ public function resolveUri(string $url, string $base): string { diff --git a/app/Jobs/SyndicateBookmarkToTwitter.php b/app/Jobs/SyndicateBookmarkToTwitter.php index d919e0b1..3aaac492 100644 --- a/app/Jobs/SyndicateBookmarkToTwitter.php +++ b/app/Jobs/SyndicateBookmarkToTwitter.php @@ -20,24 +20,20 @@ class SyndicateBookmarkToTwitter implements ShouldQueue use Queueable; use SerializesModels; - /** @var Bookmark */ - protected $bookmark; - /** * Create a new job instance. */ - public function __construct(Bookmark $bookmark) - { - $this->bookmark = $bookmark; + public function __construct( + protected Bookmark $bookmark + ) { } /** * Execute the job. * - * * @throws GuzzleException */ - public function handle(Client $guzzle) + public function handle(Client $guzzle): void { //send webmention $response = $guzzle->request( @@ -52,7 +48,7 @@ class SyndicateBookmarkToTwitter implements ShouldQueue ] ); //parse for syndication URL - if ($response->getStatusCode() == 201) { + if ($response->getStatusCode() === 201) { $json = json_decode((string) $response->getBody()); $syndicates = $this->bookmark->syndicates; $syndicates['twitter'] = $json->url; diff --git a/app/Jobs/SyndicateNoteToMastodon.php b/app/Jobs/SyndicateNoteToMastodon.php index d3346470..557006a4 100644 --- a/app/Jobs/SyndicateNoteToMastodon.php +++ b/app/Jobs/SyndicateNoteToMastodon.php @@ -19,8 +19,6 @@ class SyndicateNoteToMastodon implements ShouldQueue /** * Create a new job instance. - * - * @return void */ public function __construct( protected Note $note @@ -30,7 +28,6 @@ class SyndicateNoteToMastodon implements ShouldQueue /** * Execute the job. * - * * @throws GuzzleException */ public function handle(Client $guzzle): void diff --git a/app/Jobs/SyndicateNoteToTwitter.php b/app/Jobs/SyndicateNoteToTwitter.php index 2d6c7838..4edf10c2 100644 --- a/app/Jobs/SyndicateNoteToTwitter.php +++ b/app/Jobs/SyndicateNoteToTwitter.php @@ -18,15 +18,12 @@ class SyndicateNoteToTwitter implements ShouldQueue use Queueable; use SerializesModels; - /** @var Note */ - protected $note; - /** * Create a new job instance. */ - public function __construct(Note $note) - { - $this->note = $note; + public function __construct( + protected Note $note + ) { } /** diff --git a/app/Models/Article.php b/app/Models/Article.php index 0e33ed0f..219957ee 100644 --- a/app/Models/Article.php +++ b/app/Models/Article.php @@ -24,20 +24,24 @@ class Article extends Model use Sluggable; use SoftDeletes; - /** - * The attributes that should be mutated to dates. - * - * @var array - */ - protected $dates = ['created_at', 'updated_at', 'deleted_at']; - - /** - * The database table used by the model. - * - * @var string - */ + /** @var string */ protected $table = 'articles'; + /** @var array */ + protected $fillable = [ + 'url', + 'title', + 'main', + 'published', + ]; + + /** @var array */ + protected $casts = [ + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + 'deleted_at' => 'datetime', + ]; + /** * Return the sluggable configuration array for this model. */ @@ -50,18 +54,6 @@ class Article extends Model ]; } - /** - * The attributes that are mass assignable. - * - * @var array - */ - protected $fillable = [ - 'url', - 'title', - 'main', - 'published', - ]; - protected function html(): Attribute { return Attribute::get( diff --git a/app/Models/Bookmark.php b/app/Models/Bookmark.php index 097b461e..29bd25ad 100644 --- a/app/Models/Bookmark.php +++ b/app/Models/Bookmark.php @@ -13,28 +13,15 @@ class Bookmark extends Model { use HasFactory; - /** - * The attributes that are mass assignable. - * - * @var array - */ + /** @var array */ protected $fillable = ['url', 'name', 'content']; - /** - * The attributes that should be cast to native types. - * - * @var array - */ + /** @var array */ protected $casts = [ 'syndicates' => 'array', ]; - /** - * The tags that belong to the bookmark. - * - * @return BelongsToMany - */ - public function tags() + public function tags(): BelongsToMany { return $this->belongsToMany('App\Models\Tag'); } diff --git a/app/Models/Contact.php b/app/Models/Contact.php index 1da4d7ba..6f193f41 100644 --- a/app/Models/Contact.php +++ b/app/Models/Contact.php @@ -12,18 +12,10 @@ class Contact extends Model { use HasFactory; - /** - * The database table used by the model. - * - * @var string - */ + /** @var string */ protected $table = 'contacts'; - /** - * We shall guard against mass-migration. - * - * @var array - */ + /** @var array */ protected $fillable = ['nick', 'name', 'homepage', 'twitter', 'facebook']; protected function photo(): Attribute diff --git a/app/Models/Like.php b/app/Models/Like.php index 074fb9bd..f9ac3bcb 100644 --- a/app/Models/Like.php +++ b/app/Models/Like.php @@ -16,6 +16,7 @@ class Like extends Model use FilterHtml; use HasFactory; + /** @var array */ protected $fillable = ['url']; protected function url(): Attribute diff --git a/app/Models/Media.php b/app/Models/Media.php index de88e9b8..c4dd6d5c 100644 --- a/app/Models/Media.php +++ b/app/Models/Media.php @@ -14,23 +14,12 @@ class Media extends Model { use HasFactory; - /** - * The table associated with the model. - * - * @var string - */ + /** @var string */ protected $table = 'media_endpoint'; - /** - * The attributes that are mass assignable. - * - * @var array - */ + /** @var array */ protected $fillable = ['token', 'path', 'type', 'image_widths']; - /** - * Get the note that owns this media. - */ public function note(): BelongsTo { return $this->belongsTo(Note::class); diff --git a/app/Models/MicropubClient.php b/app/Models/MicropubClient.php index bb8bdfcf..669c7284 100644 --- a/app/Models/MicropubClient.php +++ b/app/Models/MicropubClient.php @@ -12,23 +12,12 @@ class MicropubClient extends Model { use HasFactory; - /** - * The table associated with the model. - * - * @var string - */ + /** @var string */ protected $table = 'clients'; - /** - * The attributes that are mass assignable. - * - * @var array - */ + /** @var array */ protected $fillable = ['client_url', 'client_name']; - /** - * Define the relationship with notes. - */ public function notes(): HasMany { return $this->hasMany('App\Models\Note', 'client_id', 'client_url'); diff --git a/app/Models/Note.php b/app/Models/Note.php index 9326207e..4cafa334 100644 --- a/app/Models/Note.php +++ b/app/Models/Note.php @@ -58,73 +58,46 @@ class Note extends Model $this->contacts = null; } - /** - * The database table used by the model. - * - * @var string - */ + /** @var string */ protected $table = 'notes'; - /** - * Mass-assignment. - * - * @var array - */ + /** @var array */ protected $fillable = [ 'note', 'in_reply_to', 'client_id', ]; - /** - * Hide the column used with Laravel Scout. - * - * @var array - */ + /** @var array */ protected $hidden = ['searchable']; - /** - * Define the relationship with tags. - */ public function tags(): BelongsToMany { return $this->belongsToMany(Tag::class); } - /** - * Define the relationship with clients. - */ public function client(): BelongsTo { return $this->belongsTo(MicropubClient::class, 'client_id', 'client_url'); } - /** - * Define the relationship with webmentions. - */ public function webmentions(): MorphMany { return $this->morphMany(WebMention::class, 'commentable'); } - /** - * Define the relationship with places. - */ public function place(): BelongsTo { return $this->belongsTo(Place::class); } - /** - * Define the relationship with media. - */ public function media(): HasMany { return $this->hasMany(Media::class); } /** - * Set the attributes to be indexed for searching with Scout. + * @return array */ public function toSearchableArray(): array { @@ -133,9 +106,6 @@ class Note extends Model ]; } - /** - * Normalize the note to Unicode FORM C. - */ public function setNoteAttribute(?string $value): void { if ($value !== null) { @@ -195,58 +165,37 @@ class Note extends Model return $note; } - /** - * Generate the NewBase60 ID from primary ID. - */ public function getNb60idAttribute(): string { // we cast to string because sometimes the nb60id is an “int” return (string) resolve(Numbers::class)->numto60($this->id); } - /** - * The Long URL for a note. - */ public function getLongurlAttribute(): string { return config('app.url') . '/notes/' . $this->nb60id; } - /** - * The Short URL for a note. - */ public function getShorturlAttribute(): string { return config('app.shorturl') . '/notes/' . $this->nb60id; } - /** - * Get the ISO8601 value for mf2. - */ public function getIso8601Attribute(): string { return $this->updated_at->toISO8601String(); } - /** - * Get the ISO8601 value for mf2. - */ public function getHumandiffAttribute(): string { return $this->updated_at->diffForHumans(); } - /** - * Get the publish date value for RSS feeds. - */ public function getPubdateAttribute(): string { return $this->updated_at->toRSSString(); } - /** - * Get the latitude value. - */ public function getLatitudeAttribute(): ?float { if ($this->place !== null) { @@ -262,9 +211,6 @@ class Note extends Model return null; } - /** - * Get the longitude value. - */ public function getLongitudeAttribute(): ?float { if ($this->place !== null) { @@ -281,8 +227,9 @@ class Note extends Model } /** - * Get the address for a note. This is either a reverse geo-code from the - * location, or is derived from the associated place. + * Get the address for a note. + * + * This is either a reverse geo-code from the location, or is derived from the associated place. */ public function getAddressAttribute(): ?string { @@ -337,9 +284,6 @@ class Note extends Model * Show a specific form of the note for twitter. * * That is we swap the contacts names for their known Twitter handles. - * - * - * @throws TwitterContentException */ public function getTwitterContentAttribute(): string { @@ -389,7 +333,7 @@ class Note extends Model } /** - * Swap contact’s nicks for a full mf2 h-card. + * Swap contact’s nicks for a full mf2 h-card. * * Take note that this method does two things, given @username (NOT [@username](URL)!) * we try to create a fancy hcard from our contact info. If this is not possible @@ -473,9 +417,6 @@ class Note extends Model ); } - /** - * Pass a note through the commonmark library. - */ private function convertMarkdown(string $note): string { $config = [ @@ -500,9 +441,6 @@ class Note extends Model return $markdownConverter->convert($note)->getContent(); } - /** - * Do a reverse geocode lookup of a `lat,lng` value. - */ public function reverseGeoCode(float $latitude, float $longitude): string { $latLng = $latitude . ',' . $longitude; diff --git a/app/Models/Place.php b/app/Models/Place.php index b49cf87d..dd8320d6 100644 --- a/app/Models/Place.php +++ b/app/Models/Place.php @@ -17,36 +17,20 @@ class Place extends Model use HasFactory; use Sluggable; - /** - * Get the route key for the model. - * - * @return string - */ - public function getRouteKeyName() + public function getRouteKeyName(): string { return 'slug'; } - /** - * The attributes that are mass assignable. - * - * @var array - */ + /** @var array */ protected $fillable = ['name', 'slug']; - /** - * The attributes that should be cast. - * - * @var array - */ + /** @var array */ protected $casts = [ 'latitude' => 'float', 'longitude' => 'float', ]; - /** - * Return the sluggable configuration array for this model. - */ public function sluggable(): array { return [ @@ -57,12 +41,7 @@ class Place extends Model ]; } - /** - * Define the relationship with Notes. - * - * @return HasMany - */ - public function notes() + public function notes(): HasMany { return $this->hasMany('App\Models\Note'); } diff --git a/app/Models/SyndicationTarget.php b/app/Models/SyndicationTarget.php index 1fbc3b9b..ec2d046a 100644 --- a/app/Models/SyndicationTarget.php +++ b/app/Models/SyndicationTarget.php @@ -12,11 +12,7 @@ class SyndicationTarget extends Model { use HasFactory; - /** - * The attributes that are mass assignable. - * - * @var array - */ + /** @var array */ protected $fillable = [ 'uid', 'name', @@ -28,11 +24,7 @@ class SyndicationTarget extends Model 'user_photo', ]; - /** - * The attributes that are visible when serializing the model. - * - * @var array - */ + /** @var array */ protected $visible = [ 'uid', 'name', @@ -40,21 +32,12 @@ class SyndicationTarget extends Model 'user', ]; - /** - * The accessors to append to the model's array form. - * - * @var array - */ + /** @var array */ protected $appends = [ 'service', 'user', ]; - /** - * Get the service data as a single attribute. - * - * @return Attribute - */ protected function service(): Attribute { return Attribute::get( @@ -66,11 +49,6 @@ class SyndicationTarget extends Model ); } - /** - * Get the user data as a single attribute. - * - * @vreturn Attribute - */ protected function user(): Attribute { return Attribute::get( diff --git a/app/Models/Tag.php b/app/Models/Tag.php index c573c7c6..41c75c75 100644 --- a/app/Models/Tag.php +++ b/app/Models/Tag.php @@ -14,29 +14,15 @@ class Tag extends Model { use HasFactory; - /** - * We shall set a blacklist of non-modifiable model attributes. - * - * @var array - */ + /** @var array */ protected $guarded = ['id']; - /** - * Define the relationship with notes. - * - * @return BelongsToMany - */ - public function notes() + public function notes(): BelongsToMany { return $this->belongsToMany(Note::class); } - /** - * The bookmarks that belong to the tag. - * - * @return BelongsToMany - */ - public function bookmarks() + public function bookmarks(): BelongsToMany { return $this->belongsToMany('App\Models\Bookmark'); } @@ -49,8 +35,9 @@ class Tag extends Model } /** - * This method actually normalizes a tag. That means lowercase-ing and - * removing fancy diatric characters. + * Normalizes a tag. + * + * That means convert to lowercase and removing fancy diatric characters. */ public static function normalize(string $tag): string { diff --git a/app/Models/User.php b/app/Models/User.php index c4d76e1e..bc57ee54 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -13,21 +13,15 @@ class User extends Authenticatable use HasFactory; use Notifiable; - /** - * The attributes that are mass assignable. - * - * @var array - */ + /** @var array */ protected $fillable = [ 'name', 'password', ]; - /** - * The attributes that should be hidden for arrays. - * - * @var array - */ + /** @var array */ protected $hidden = [ - 'password', 'remember_token', + 'current_password', + 'password', + 'remember_token', ]; } diff --git a/app/Models/WebMention.php b/app/Models/WebMention.php index 3464e93a..a1514517 100644 --- a/app/Models/WebMention.php +++ b/app/Models/WebMention.php @@ -20,26 +20,13 @@ class WebMention extends Model use FilterHtml; use HasFactory; - /** - * The database table used by the model. - * - * @var string - */ + /** @var string */ protected $table = 'webmentions'; - /** - * We shall set a blacklist of non-modifiable model attributes. - * - * @var array - */ + /** @var array */ protected $guarded = ['id']; - /** - * Define the relationship. - * - * @return MorphTo - */ - public function commentable() + public function commentable(): MorphTo { return $this->morphTo(); } diff --git a/app/Observers/NoteObserver.php b/app/Observers/NoteObserver.php index 07033cd0..d4b3120c 100644 --- a/app/Observers/NoteObserver.php +++ b/app/Observers/NoteObserver.php @@ -14,7 +14,7 @@ class NoteObserver /** * Listen to the Note created event. */ - public function created(Note $note) + public function created(Note $note): void { $text = Arr::get($note->getAttributes(), 'note'); if ($text === null) { @@ -36,7 +36,7 @@ class NoteObserver /** * Listen to the Note updated event. */ - public function updated(Note $note) + public function updated(Note $note): void { $text = Arr::get($note->getAttributes(), 'note'); if ($text === null) { @@ -60,7 +60,7 @@ class NoteObserver /** * Listen to the Note deleting event. */ - public function deleting(Note $note) + public function deleting(Note $note): void { $note->tags()->detach(); } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 03bfa4aa..67d7a2f4 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -25,10 +25,8 @@ class AppServiceProvider extends ServiceProvider { /** * Bootstrap any application services. - * - * @return void */ - public function boot() + public function boot(): void { Note::observe(NoteObserver::class); @@ -144,10 +142,8 @@ class AppServiceProvider extends ServiceProvider /** * Register any application services. - * - * @return void */ - public function register() + public function register(): void { if ($this->app->environment('local', 'testing')) { $this->app->register(DuskServiceProvider::class); diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index c776912f..faa84c0d 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -7,16 +7,16 @@ use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvid class AuthServiceProvider extends ServiceProvider { /** - * The policy mappings for the application. + * The model to policy mappings for the application. * - * @var array + * @var array */ protected $policies = [ // 'App\Models\Model' => 'App\Policies\ModelPolicy', ]; /** - * Register any application authentication / authorization services. + * Register any authentication / authorization services. */ public function boot(): void { diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index c1f5ec4b..147f27b7 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -12,10 +12,8 @@ class BroadcastServiceProvider extends ServiceProvider { /** * Bootstrap any application services. - * - * @return void */ - public function boot() + public function boot(): void { Broadcast::routes(); diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 723a290d..3b514f53 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -10,9 +10,9 @@ use Illuminate\Support\Facades\Event; class EventServiceProvider extends ServiceProvider { /** - * The event listener mappings for the application. + * The event to listener mappings for the application. * - * @var array + * @var array> */ protected $listen = [ Registered::class => [ @@ -22,13 +22,9 @@ class EventServiceProvider extends ServiceProvider /** * Register any events for your application. - * - * @return void */ - public function boot() + public function boot(): void { - parent::boot(); - // } } diff --git a/app/Providers/HorizonServiceProvider.php b/app/Providers/HorizonServiceProvider.php index 89a3c7b4..4d54239b 100644 --- a/app/Providers/HorizonServiceProvider.php +++ b/app/Providers/HorizonServiceProvider.php @@ -10,10 +10,8 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider { /** * Bootstrap any application services. - * - * @return void */ - public function boot() + public function boot(): void { parent::boot(); @@ -28,10 +26,8 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider * Register the Horizon gate. * * This gate determines who can access Horizon in non-local environments. - * - * @return void */ - protected function gate() + protected function gate(): void { Gate::define('viewHorizon', function ($user) { return $user->name === 'jonny'; diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 3f8af660..caecf5f4 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -11,46 +11,38 @@ use Illuminate\Support\Facades\Route; class RouteServiceProvider extends ServiceProvider { /** - * This namespace is applied to your controller routes. + * The path to the "home" route for your application. * - * In addition, it is set as the URL generator's root namespace. + * Typically, users are redirected here after authentication. * - * @var string|null + * @var string */ - // protected $namespace = 'App\Http\Controllers'; + public const HOME = '/admin'; /** - * Define your route model bindings, pattern filters, etc. - * - * @return void + * Define your route model bindings, pattern filters, and other route configuration. */ - public function boot() + public function boot(): void { $this->configureRateLimiting(); $this->routes(function () { - Route::prefix('api') - ->middleware('api') - ->namespace($this->namespace) + Route::middleware('api') + ->prefix('api') ->group(base_path('routes/api.php')); Route::middleware('web') - ->namespace($this->namespace) ->group(base_path('routes/web.php')); }); } /** * Configure the rate limiters for the application. - * - * @return void - * - * @codeCoverageIgnore */ - protected function configureRateLimiting() + protected function configureRateLimiting(): void { RateLimiter::for('api', function (Request $request) { - return Limit::perMinute(60); + return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); }); } } diff --git a/app/Services/ActivityStreamsService.php b/app/Services/ActivityStreamsService.php index db7a1917..e439e539 100644 --- a/app/Services/ActivityStreamsService.php +++ b/app/Services/ActivityStreamsService.php @@ -5,15 +5,14 @@ declare(strict_types=1); namespace App\Services; use App\Models\Note; +use Illuminate\Http\Response; class ActivityStreamsService { /** * Return the relevant data to an AS2.0 request to the root path. - * - * @return \Illuminate\Http\Response */ - public function siteOwnerResponse() + public function siteOwnerResponse(): Response { $data = json_encode([ '@context' => 'https://www.w3.org/ns/activitystreams', @@ -28,10 +27,8 @@ class ActivityStreamsService /** * Return the relevant data to an AS2.0 request for a particular note. - * - * @return \Illuminate\Http\Response */ - public function singleNoteResponse(Note $note) + public function singleNoteResponse(Note $note): Response { $data = json_encode([ '@context' => 'https://www.w3.org/ns/activitystreams', diff --git a/app/Services/BookmarkService.php b/app/Services/BookmarkService.php index 9078153e..afed64fc 100644 --- a/app/Services/BookmarkService.php +++ b/app/Services/BookmarkService.php @@ -19,8 +19,6 @@ class BookmarkService extends Service { /** * Create a new Bookmark. - * - * @param array $request Data from request()->all() */ public function create(array $request, ?string $client = null): Bookmark { @@ -74,7 +72,6 @@ class BookmarkService extends Service /** * Given a URL, attempt to save it to the Internet Archive. * - * * @throws InternetArchiveException */ public function getArchiveLink(string $url): string diff --git a/app/Services/LikeService.php b/app/Services/LikeService.php index b1168c27..efd2216b 100644 --- a/app/Services/LikeService.php +++ b/app/Services/LikeService.php @@ -12,8 +12,6 @@ class LikeService extends Service { /** * Create a new Like. - * - * @return Like $like */ public function create(array $request, ?string $client = null): Like { diff --git a/app/Services/Micropub/HCardService.php b/app/Services/Micropub/HCardService.php index 1685351c..7ab57a4e 100644 --- a/app/Services/Micropub/HCardService.php +++ b/app/Services/Micropub/HCardService.php @@ -11,8 +11,6 @@ class HCardService { /** * Create a Place from h-card data, return the URL. - * - * @param array $request Data from request()->all() */ public function process(array $request): string { @@ -28,8 +26,7 @@ class HCardService $data['latitude'] = Arr::get($request, 'latitude'); $data['longitude'] = Arr::get($request, 'longitude'); } - $place = resolve(PlaceService::class)->createPlace($data); - return $place->longurl; + return resolve(PlaceService::class)->createPlace($data)->longurl; } } diff --git a/app/Services/Micropub/HEntryService.php b/app/Services/Micropub/HEntryService.php index 9011540c..807e6327 100644 --- a/app/Services/Micropub/HEntryService.php +++ b/app/Services/Micropub/HEntryService.php @@ -13,10 +13,7 @@ use Illuminate\Support\Arr; class HEntryService { /** - * Create the relavent model from some h-entry data. - * - * @param array $request Data from request()->all() - * @param string|null $client The micropub client that made the request + * Create the relevant model from some h-entry data. */ public function process(array $request, ?string $client = null): ?string { diff --git a/app/Services/Micropub/UpdateService.php b/app/Services/Micropub/UpdateService.php index f056c475..ac9d360a 100644 --- a/app/Services/Micropub/UpdateService.php +++ b/app/Services/Micropub/UpdateService.php @@ -7,6 +7,7 @@ namespace App\Services\Micropub; use App\Models\Media; use App\Models\Note; use Illuminate\Database\Eloquent\ModelNotFoundException; +use Illuminate\Http\JsonResponse; use Illuminate\Support\Arr; use Illuminate\Support\Str; @@ -14,11 +15,8 @@ class UpdateService { /** * Process a micropub request to update an entry. - * - * @param array $request Data from request()->all() - * @return \Illuminate\Http\JsonResponse */ - public function process(array $request) + public function process(array $request): JsonResponse { $urlPath = parse_url(Arr::get($request, 'url'), PHP_URL_PATH); @@ -42,10 +40,10 @@ class UpdateService //got the note, are we dealing with a “replace” request? if (Arr::get($request, 'replace')) { foreach (Arr::get($request, 'replace') as $property => $value) { - if ($property == 'content') { + if ($property === 'content') { $note->note = $value[0]; } - if ($property == 'syndication') { + if ($property === 'syndication') { foreach ($value as $syndicationURL) { if (Str::startsWith($syndicationURL, 'https://www.facebook.com')) { $note->facebook_url = $syndicationURL; @@ -69,7 +67,7 @@ class UpdateService //how about “add” if (Arr::get($request, 'add')) { foreach (Arr::get($request, 'add') as $property => $value) { - if ($property == 'syndication') { + if ($property === 'syndication') { foreach ($value as $syndicationURL) { if (Str::startsWith($syndicationURL, 'https://www.facebook.com')) { $note->facebook_url = $syndicationURL; @@ -82,7 +80,7 @@ class UpdateService } } } - if ($property == 'photo') { + if ($property === 'photo') { foreach ($value as $photoURL) { if (Str::startsWith($photoURL, 'https://')) { $media = new Media(); diff --git a/app/Services/NoteService.php b/app/Services/NoteService.php index 4119c38b..28ee5104 100644 --- a/app/Services/NoteService.php +++ b/app/Services/NoteService.php @@ -18,8 +18,6 @@ class NoteService extends Service { /** * Create a new note. - * - * @param array $request Data from request()->all() */ public function create(array $request, ?string $client = null): Note { @@ -66,8 +64,6 @@ class NoteService extends Service /** * Get the published time from the request to create a new note. - * - * @param array $request Data from request()->all() */ private function getPublished(array $request): ?string { @@ -84,13 +80,11 @@ class NoteService extends Service /** * Get the location data from the request to create a new note. - * - * @param array $request Data from request()->all() */ private function getLocation(array $request): ?string { $location = Arr::get($request, 'properties.location.0') ?? Arr::get($request, 'location'); - if (is_string($location) && substr($location, 0, 4) == 'geo:') { + if (is_string($location) && str_starts_with($location, 'geo:')) { preg_match_all( '/([0-9\.\-]+)/', $location, @@ -105,8 +99,6 @@ class NoteService extends Service /** * Get the checkin data from the request to create a new note. This will be a Place. - * - * @param array $request Data from request()->all() */ private function getCheckin(array $request): ?Place { @@ -150,12 +142,10 @@ class NoteService extends Service /** * Get the Swarm URL from the syndication data in the request to create a new note. - * - * @param array $request Data from request()->all() */ private function getSwarmUrl(array $request): ?string { - if (stristr(Arr::get($request, 'properties.syndication.0', ''), 'swarmapp')) { + if (str_contains(Arr::get($request, 'properties.syndication.0', ''), 'swarmapp')) { return Arr::get($request, 'properties.syndication.0'); } @@ -164,8 +154,6 @@ class NoteService extends Service /** * Get the syndication targets from the request to create a new note. - * - * @param array $request Data from request()->all() */ private function getSyndicationTargets(array $request): array { @@ -187,8 +175,6 @@ class NoteService extends Service /** * Get the media URLs from the request to create a new note. - * - * @param array $request Data from request()->all() */ private function getMedia(array $request): array { @@ -216,8 +202,6 @@ class NoteService extends Service /** * Get the Instagram photo URL from the request to create a new note. - * - * @param array $request Data from request()->all() */ private function getInstagramUrl(array $request): ?string { diff --git a/app/Services/PlaceService.php b/app/Services/PlaceService.php index 3b2de225..d3756253 100644 --- a/app/Services/PlaceService.php +++ b/app/Services/PlaceService.php @@ -37,8 +37,6 @@ class PlaceService /** * Create a place from a h-card checkin, for example from OwnYourSwarm. - * - * @param array */ public function createPlaceFromCheckin(array $checkin): Place { diff --git a/app/Services/TokenService.php b/app/Services/TokenService.php index 844852fb..fddccff0 100644 --- a/app/Services/TokenService.php +++ b/app/Services/TokenService.php @@ -13,9 +13,6 @@ class TokenService { /** * Generate a JWT token. - * - * @param array The data to be encoded - * @return string The signed token */ public function getNewToken(array $data): string { @@ -36,9 +33,6 @@ class TokenService /** * Check the token signature is valid. - * - * @param string The token - * @return mixed */ public function validateToken(string $bearerToken): Token { diff --git a/artisan b/artisan index 5c23e2e2..67a3329b 100755 --- a/artisan +++ b/artisan @@ -11,7 +11,7 @@ define('LARAVEL_START', microtime(true)); | Composer provides a convenient, automatically generated class loader | for our application. We just need to utilize it! We'll require it | into the script here so that we do not have to worry about the -| loading of any our classes "manually". Feels great to relax. +| loading of any of our classes manually. It's great to relax. | */ diff --git a/config/app.php b/config/app.php index 26a66d9a..0c0fd785 100644 --- a/config/app.php +++ b/config/app.php @@ -63,7 +63,7 @@ return [ | Application Long URL |-------------------------------------------------------------------------- | - | The short URL for the application + | The long URL for the application | */ @@ -191,7 +191,9 @@ return [ |-------------------------------------------------------------------------- | Font Link |-------------------------------------------------------------------------- + | | Which URL should the app load custom fonts from + | */ 'font_link' => env('FONT_LINK'), diff --git a/config/auth.php b/config/auth.php index d8c6cee7..cae00280 100644 --- a/config/auth.php +++ b/config/auth.php @@ -84,12 +84,16 @@ return [ | considered valid. This security feature keeps tokens short-lived so | they have less time to be guessed. You may change this as needed. | + | The throttle setting is the number of seconds a user must wait before + | generating more password reset tokens. This prevents the user from + | quickly generating a very large amount of password reset tokens. + | */ 'passwords' => [ 'users' => [ 'provider' => 'users', - 'table' => 'password_resets', + 'table' => 'password_reset_tokens', 'expire' => 60, 'throttle' => 60, ], diff --git a/config/mail.php b/config/mail.php index 534395a3..542d98c3 100644 --- a/config/mail.php +++ b/config/mail.php @@ -28,7 +28,7 @@ return [ | sending an e-mail. You will specify which one you are using for your | mailers below. You are free to add additional mailers as required. | - | Supported: "smtp", "sendmail", "mailgun", "ses", + | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2", | "postmark", "log", "array", "failover" | */ @@ -51,10 +51,16 @@ return [ 'mailgun' => [ 'transport' => 'mailgun', + // 'client' => [ + // 'timeout' => 5, + // ], ], 'postmark' => [ 'transport' => 'postmark', + // 'client' => [ + // 'timeout' => 5, + // ], ], 'sendmail' => [ diff --git a/database/factories/ArticleFactory.php b/database/factories/ArticleFactory.php index 2b69f126..7695e27e 100644 --- a/database/factories/ArticleFactory.php +++ b/database/factories/ArticleFactory.php @@ -6,6 +6,9 @@ use App\Models\Article; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Carbon; +/** + * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Article> + */ class ArticleFactory extends Factory { /** @@ -18,9 +21,9 @@ class ArticleFactory extends Factory /** * Define the model's default state. * - * @return array + * @return array */ - public function definition() + public function definition(): array { return [ 'titleurl' => $this->faker->slug(3), diff --git a/database/factories/BookmarkFactory.php b/database/factories/BookmarkFactory.php index ae4e7848..ddfe0f97 100644 --- a/database/factories/BookmarkFactory.php +++ b/database/factories/BookmarkFactory.php @@ -6,6 +6,9 @@ use App\Models\Bookmark; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Carbon; +/** + * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Bookmark> + */ class BookmarkFactory extends Factory { /** @@ -18,9 +21,9 @@ class BookmarkFactory extends Factory /** * Define the model's default state. * - * @return array + * @return array */ - public function definition() + public function definition(): array { $now = Carbon::now()->subDays(rand(5, 15)); diff --git a/database/factories/ContactFactory.php b/database/factories/ContactFactory.php index 175bc280..1b0be43b 100644 --- a/database/factories/ContactFactory.php +++ b/database/factories/ContactFactory.php @@ -6,6 +6,9 @@ use App\Models\Contact; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Carbon; +/** + * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Contact> + */ class ContactFactory extends Factory { /** @@ -18,9 +21,9 @@ class ContactFactory extends Factory /** * Define the model's default state. * - * @return array + * @return array */ - public function definition() + public function definition(): array { return [ 'nick' => mb_strtolower($this->faker->firstName), diff --git a/database/factories/LikeFactory.php b/database/factories/LikeFactory.php index ed6510c1..8bf4f62f 100644 --- a/database/factories/LikeFactory.php +++ b/database/factories/LikeFactory.php @@ -6,6 +6,9 @@ use App\Models\Like; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Carbon; +/** + * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Like> + */ class LikeFactory extends Factory { /** @@ -18,9 +21,9 @@ class LikeFactory extends Factory /** * Define the model's default state. * - * @return array + * @return array */ - public function definition() + public function definition(): array { $now = Carbon::now()->subDays(rand(5, 15)); diff --git a/database/factories/MediaFactory.php b/database/factories/MediaFactory.php index b3a44d78..ca253109 100644 --- a/database/factories/MediaFactory.php +++ b/database/factories/MediaFactory.php @@ -6,6 +6,9 @@ use App\Models\Media; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Carbon; +/** + * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Media> + */ class MediaFactory extends Factory { /** @@ -18,9 +21,9 @@ class MediaFactory extends Factory /** * Define the model's default state. * - * @return array + * @return array */ - public function definition() + public function definition(): array { return [ 'path' => 'media/' . $this->faker->uuid . '.jpg', diff --git a/database/factories/MicropubClientFactory.php b/database/factories/MicropubClientFactory.php index 73b08917..4916f404 100644 --- a/database/factories/MicropubClientFactory.php +++ b/database/factories/MicropubClientFactory.php @@ -5,6 +5,9 @@ namespace Database\Factories; use App\Models\MicropubClient; use Illuminate\Database\Eloquent\Factories\Factory; +/** + * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\MicropubClient> + */ class MicropubClientFactory extends Factory { /** @@ -17,9 +20,9 @@ class MicropubClientFactory extends Factory /** * Define the model's default state. * - * @return array + * @return array */ - public function definition() + public function definition(): array { return [ 'client_url' => $this->faker->url, diff --git a/database/factories/NoteFactory.php b/database/factories/NoteFactory.php index cbe2e09d..e2238a23 100644 --- a/database/factories/NoteFactory.php +++ b/database/factories/NoteFactory.php @@ -7,6 +7,9 @@ use Exception; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Carbon; +/** + * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Note> + */ class NoteFactory extends Factory { /** @@ -19,11 +22,11 @@ class NoteFactory extends Factory /** * Define the model's default state. * - * @return array + * @return array * * @throws Exception */ - public function definition() + public function definition(): array { $now = Carbon::now()->subDays(random_int(5, 15)); diff --git a/database/factories/PlaceFactory.php b/database/factories/PlaceFactory.php index ef531e02..61bdd70f 100644 --- a/database/factories/PlaceFactory.php +++ b/database/factories/PlaceFactory.php @@ -5,6 +5,9 @@ namespace Database\Factories; use App\Models\Place; use Illuminate\Database\Eloquent\Factories\Factory; +/** + * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Place> + */ class PlaceFactory extends Factory { /** @@ -17,9 +20,9 @@ class PlaceFactory extends Factory /** * Define the model's default state. * - * @return array + * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->company, diff --git a/database/factories/SyndicationTargetFactory.php b/database/factories/SyndicationTargetFactory.php index c877c9d4..05243632 100644 --- a/database/factories/SyndicationTargetFactory.php +++ b/database/factories/SyndicationTargetFactory.php @@ -14,7 +14,7 @@ class SyndicationTargetFactory extends Factory * * @return array */ - public function definition() + public function definition(): array { return [ 'uid' => $this->faker->url, diff --git a/database/factories/TagFactory.php b/database/factories/TagFactory.php index be4d3afd..24cae028 100644 --- a/database/factories/TagFactory.php +++ b/database/factories/TagFactory.php @@ -5,6 +5,9 @@ namespace Database\Factories; use App\Models\Tag; use Illuminate\Database\Eloquent\Factories\Factory; +/** + * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Tag> + */ class TagFactory extends Factory { /** @@ -17,9 +20,9 @@ class TagFactory extends Factory /** * Define the model's default state. * - * @return array + * @return array */ - public function definition() + public function definition(): array { return [ 'tag' => $this->faker->word, diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 7efccfd4..ba1ff997 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -6,6 +6,9 @@ use App\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; +/** + * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User> + */ class UserFactory extends Factory { /** @@ -18,9 +21,9 @@ class UserFactory extends Factory /** * Define the model's default state. * - * @return array + * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->name, diff --git a/database/factories/WebMentionFactory.php b/database/factories/WebMentionFactory.php index b9a97fef..65dbb92f 100644 --- a/database/factories/WebMentionFactory.php +++ b/database/factories/WebMentionFactory.php @@ -5,6 +5,9 @@ namespace Database\Factories; use App\Models\WebMention; use Illuminate\Database\Eloquent\Factories\Factory; +/** + * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\WebMention> + */ class WebMentionFactory extends Factory { /** @@ -17,9 +20,9 @@ class WebMentionFactory extends Factory /** * Define the model's default state. * - * @return array + * @return array */ - public function definition() + public function definition(): array { return [ 'source' => $this->faker->url, diff --git a/database/migrations/2015_02_28_132629_create_articles_table.php b/database/migrations/2015_02_28_132629_create_articles_table.php deleted file mode 100644 index 5b2ec299..00000000 --- a/database/migrations/2015_02_28_132629_create_articles_table.php +++ /dev/null @@ -1,38 +0,0 @@ -increments('id'); - $table->string('titleurl', 50)->unique(); - $table->string('url', 120)->nullable(); - $table->string('title'); - $table->longText('main'); - $table->tinyInteger('published')->default(0); - $table->timestamps(); - $table->softDeletes(); - }); - } - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('articles'); - } -} diff --git a/database/migrations/2015_02_28_144939_create_notes_table.php b/database/migrations/2015_02_28_144939_create_notes_table.php deleted file mode 100644 index 50196f81..00000000 --- a/database/migrations/2015_02_28_144939_create_notes_table.php +++ /dev/null @@ -1,40 +0,0 @@ -increments('id'); - $table->text('note'); - $table->string('in_reply_to')->nullable(); - $table->string('shorturl', 20)->nullable(); - $table->string('location')->nullable(); - $table->tinyInteger('photo')->nullable(); - $table->string('tweet_id')->nullable(); - $table->string('client_id')->nullable(); - $table->timestamps(); - $table->softDeletes(); - }); - } - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('notes'); - } -} diff --git a/database/migrations/2015_03_02_084342_create_tags_table.php b/database/migrations/2015_03_02_084342_create_tags_table.php deleted file mode 100644 index 0e395f8c..00000000 --- a/database/migrations/2015_03_02_084342_create_tags_table.php +++ /dev/null @@ -1,31 +0,0 @@ -increments('id'); - $table->string('tag'); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('tags'); - } -} diff --git a/database/migrations/2015_03_02_084956_create_note_tag_table.php b/database/migrations/2015_03_02_084956_create_note_tag_table.php deleted file mode 100644 index 0c111ab0..00000000 --- a/database/migrations/2015_03_02_084956_create_note_tag_table.php +++ /dev/null @@ -1,33 +0,0 @@ -increments('id'); - $table->integer('note_id')->unsigned(); - $table->integer('tag_id')->unsigned(); - $table->foreign('note_id')->references('id')->on('notes'); - $table->foreign('tag_id')->references('id')->on('tags'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('note_tag'); - } -} diff --git a/database/migrations/2015_03_02_105623_create_contacts_table.php b/database/migrations/2015_03_02_105623_create_contacts_table.php deleted file mode 100644 index 8944d068..00000000 --- a/database/migrations/2015_03_02_105623_create_contacts_table.php +++ /dev/null @@ -1,34 +0,0 @@ -increments('id'); - $table->string('nick'); - $table->string('name'); - $table->string('homepage')->nullable(); - $table->string('twitter')->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('contacts'); - } -} diff --git a/database/migrations/2015_03_02_114340_create_web_mentions_table.php b/database/migrations/2015_03_02_114340_create_web_mentions_table.php deleted file mode 100644 index aa29fe2e..00000000 --- a/database/migrations/2015_03_02_114340_create_web_mentions_table.php +++ /dev/null @@ -1,38 +0,0 @@ -increments('id'); - $table->string('source'); - $table->string('target'); - $table->integer('commentable_id')->nullable(); - $table->string('commentable_type')->nullable(); - $table->string('type')->nullable(); - $table->text('content')->nullable(); - $table->tinyInteger('verified')->default(1); - $table->timestamps(); - $table->softDeletes(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('webmentions'); - } -} diff --git a/database/migrations/2015_07_17_111512_create_clients_table.php b/database/migrations/2015_07_17_111512_create_clients_table.php deleted file mode 100644 index b545c641..00000000 --- a/database/migrations/2015_07_17_111512_create_clients_table.php +++ /dev/null @@ -1,32 +0,0 @@ -increments('id'); - $table->string('client_url'); - $table->string('client_name'); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('clients'); - } -} diff --git a/database/migrations/2015_10_08_155111_create_media_table.php b/database/migrations/2015_10_08_155111_create_media_table.php deleted file mode 100644 index d30bceca..00000000 --- a/database/migrations/2015_10_08_155111_create_media_table.php +++ /dev/null @@ -1,36 +0,0 @@ -increments('id'); - $table->morphs('model'); - $table->string('collection_name'); - $table->string('name'); - $table->string('file_name'); - $table->string('disk'); - $table->unsignedInteger('size'); - $table->text('manipulations'); - $table->text('custom_properties'); - $table->unsignedInteger('order_column')->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down() - { - Schema::drop('media'); - } -} diff --git a/database/migrations/2015_11_07_130637_create_places_table.php b/database/migrations/2015_11_07_130637_create_places_table.php deleted file mode 100644 index 8630b95f..00000000 --- a/database/migrations/2015_11_07_130637_create_places_table.php +++ /dev/null @@ -1,35 +0,0 @@ -increments('id'); - $table->string('name'); - $table->string('slug')->unique(); - $table->text('description')->nullable(); - $table->text('location'); - $table->text('polygon')->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('places'); - } -} diff --git a/database/migrations/2015_11_19_221933_add_place_relation_to_notes.php b/database/migrations/2015_11_19_221933_add_place_relation_to_notes.php deleted file mode 100644 index 762b6830..00000000 --- a/database/migrations/2015_11_19_221933_add_place_relation_to_notes.php +++ /dev/null @@ -1,33 +0,0 @@ -integer('place_id')->unsigned()->nullable(); - $table->foreign('place_id')->references('id')->on('places'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('notes', function (Blueprint $table) { - $table->dropForeign('notes_place_id_foreign'); - $table->dropColumn('place_id'); - }); - } -} diff --git a/database/migrations/2016_07_29_113150_add_jsonb_mf2_column_to_webmentions_table.php b/database/migrations/2016_07_29_113150_add_jsonb_mf2_column_to_webmentions_table.php deleted file mode 100644 index 131273df..00000000 --- a/database/migrations/2016_07_29_113150_add_jsonb_mf2_column_to_webmentions_table.php +++ /dev/null @@ -1,33 +0,0 @@ -jsonb('mf2')->nullable(); - $table->index(['mf2']); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('webmentions', function (Blueprint $table) { - $table->dropIndex(['mf2']); - $table->dropColumn('mf2'); - }); - } -} diff --git a/database/migrations/2016_09_30_214651_cascade_delete_note_tags.php b/database/migrations/2016_09_30_214651_cascade_delete_note_tags.php deleted file mode 100644 index 6381f27c..00000000 --- a/database/migrations/2016_09_30_214651_cascade_delete_note_tags.php +++ /dev/null @@ -1,30 +0,0 @@ -dropForeign('note_tag_note_id_foreign'); - $table->foreign('note_id')->references('id')->on('notes')->onDelete('cascade'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - // - } -} diff --git a/database/migrations/2016_10_26_170858_add_facebook_url_column_to_notes.php b/database/migrations/2016_10_26_170858_add_facebook_url_column_to_notes.php deleted file mode 100644 index ed5dd250..00000000 --- a/database/migrations/2016_10_26_170858_add_facebook_url_column_to_notes.php +++ /dev/null @@ -1,30 +0,0 @@ -string('facebook_url')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - // - } -} diff --git a/database/migrations/2016_11_23_154939_add_facebook_to_contacts.php b/database/migrations/2016_11_23_154939_add_facebook_to_contacts.php deleted file mode 100644 index b5c7fd1c..00000000 --- a/database/migrations/2016_11_23_154939_add_facebook_to_contacts.php +++ /dev/null @@ -1,32 +0,0 @@ -string('facebook')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('contacts', function (Blueprint $table) { - $table->dropColumn('facebook'); - }); - } -} diff --git a/database/migrations/2016_12_05_204035_add_search_to_notes.php b/database/migrations/2016_12_05_204035_add_search_to_notes.php deleted file mode 100644 index fa7a6493..00000000 --- a/database/migrations/2016_12_05_204035_add_search_to_notes.php +++ /dev/null @@ -1,33 +0,0 @@ -string('icon')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('places', function (Blueprint $table) { - $table->dropColumn('icon'); - }); - } -} diff --git a/database/migrations/2017_03_09_155908_create_media_endpoint_table.php b/database/migrations/2017_03_09_155908_create_media_endpoint_table.php deleted file mode 100644 index cd48f961..00000000 --- a/database/migrations/2017_03_09_155908_create_media_endpoint_table.php +++ /dev/null @@ -1,41 +0,0 @@ -increments('id'); - $table->text('token')->nullable(); - $table->string('path'); - $table->string('type'); - $table->unsignedInteger('note_id')->nullable(); - $table->timestamps(); - - $table->index('token'); - $table->foreign('note_id')->references('id')->on('notes'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('media_endpoint', function (Blueprint $table) { - $table->dropForeign(['note_id']); - }); - Schema::dropIfExists('media_endpoint'); - } -} diff --git a/database/migrations/2017_03_28_130855_create_indie_web_users_table.php b/database/migrations/2017_03_28_130855_create_indie_web_users_table.php deleted file mode 100644 index 53b9ea8f..00000000 --- a/database/migrations/2017_03_28_130855_create_indie_web_users_table.php +++ /dev/null @@ -1,36 +0,0 @@ -increments('id'); - $table->string('me')->unique(); - $table->text('token')->nullable(); - $table->string('syntax')->default('json'); - $table->jsonb('syndication')->nullable(); - $table->string('mediaEndpoint')->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('indie_web_users'); - } -} diff --git a/database/migrations/2017_04_25_203734_update_notes_table_add_swarm_url.php b/database/migrations/2017_04_25_203734_update_notes_table_add_swarm_url.php deleted file mode 100644 index b5f72a18..00000000 --- a/database/migrations/2017_04_25_203734_update_notes_table_add_swarm_url.php +++ /dev/null @@ -1,32 +0,0 @@ -string('swarm_url')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('notes', function (Blueprint $table) { - $table->dropColumn('swarm_url'); - }); - } -} diff --git a/database/migrations/2017_05_12_135451_update_places_table_add_foursquare_column.php b/database/migrations/2017_05_12_135451_update_places_table_add_foursquare_column.php deleted file mode 100644 index f4b16629..00000000 --- a/database/migrations/2017_05_12_135451_update_places_table_add_foursquare_column.php +++ /dev/null @@ -1,32 +0,0 @@ -string('foursquare')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('places', function (Blueprint $table) { - $table->dropColumn('foursquare'); - }); - } -} diff --git a/database/migrations/2017_06_11_193737_update_notes_table_add_instagram_url.php b/database/migrations/2017_06_11_193737_update_notes_table_add_instagram_url.php deleted file mode 100644 index 1eb120e8..00000000 --- a/database/migrations/2017_06_11_193737_update_notes_table_add_instagram_url.php +++ /dev/null @@ -1,32 +0,0 @@ -string('instagram_url')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('notes', function (Blueprint $table) { - $table->dropColumn('instagram_url'); - }); - } -} diff --git a/database/migrations/2017_06_27_164743_update_places_table_add_external_urls.php b/database/migrations/2017_06_27_164743_update_places_table_add_external_urls.php deleted file mode 100644 index e4acfe8f..00000000 --- a/database/migrations/2017_06_27_164743_update_places_table_add_external_urls.php +++ /dev/null @@ -1,34 +0,0 @@ -jsonb('external_urls')->nullable(); - $table->index('external_urls'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('places', function (Blueprint $table) { - $table->dropIndex('places_external_urls_index'); - $table->dropColumn('external_urls'); - }); - } -} diff --git a/database/migrations/2017_08_09_181357_allow_empty_note_content.php b/database/migrations/2017_08_09_181357_allow_empty_note_content.php deleted file mode 100644 index dbe415fe..00000000 --- a/database/migrations/2017_08_09_181357_allow_empty_note_content.php +++ /dev/null @@ -1,34 +0,0 @@ -text('image_widths')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('media_endpoint', function (Blueprint $table) { - $table->dropColumn('image_widths'); - }); - } -} diff --git a/database/migrations/2017_09_16_191741_create_likes_table.php b/database/migrations/2017_09_16_191741_create_likes_table.php deleted file mode 100644 index 5435d9e1..00000000 --- a/database/migrations/2017_09_16_191741_create_likes_table.php +++ /dev/null @@ -1,35 +0,0 @@ -increments('id'); - $table->string('url'); - $table->string('author_name')->nullable(); - $table->string('author_url')->nullable(); - $table->text('content')->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('likes'); - } -} diff --git a/database/migrations/2017_10_07_163425_create_bookmarks_table.php b/database/migrations/2017_10_07_163425_create_bookmarks_table.php deleted file mode 100644 index 8bcaeadf..00000000 --- a/database/migrations/2017_10_07_163425_create_bookmarks_table.php +++ /dev/null @@ -1,37 +0,0 @@ -increments('id'); - $table->string('url'); - $table->string('name')->nullable(); - $table->text('content')->nullable(); - $table->uuid('screenshot')->nullable(); - $table->string('archive')->nullable(); - $table->jsonb('syndicates')->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('bookmarks'); - } -} diff --git a/database/migrations/2017_10_07_164651_create_bookmark_tag_pivot_table.php b/database/migrations/2017_10_07_164651_create_bookmark_tag_pivot_table.php deleted file mode 100644 index e3d13929..00000000 --- a/database/migrations/2017_10_07_164651_create_bookmark_tag_pivot_table.php +++ /dev/null @@ -1,36 +0,0 @@ -increments('id'); - $table->unsignedInteger('bookmark_id'); - $table->unsignedInteger('tag_id'); - $table->timestamps(); - - $table->foreign('bookmark_id')->references('id')->on('bookmarks'); - $table->foreign('tag_id')->references('id')->on('tags'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('bookmark_tag'); - } -} diff --git a/database/migrations/2017_12_19_160117_update_models_reference_in_webmentions_table.php b/database/migrations/2017_12_19_160117_update_models_reference_in_webmentions_table.php deleted file mode 100644 index 0cec1b4c..00000000 --- a/database/migrations/2017_12_19_160117_update_models_reference_in_webmentions_table.php +++ /dev/null @@ -1,32 +0,0 @@ -schema = Schema::connection( - config('telescope.storage.database.connection') - ); - } - - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - $this->schema->create('telescope_entries', function (Blueprint $table) { - $table->bigIncrements('sequence'); - $table->uuid('uuid'); - $table->uuid('batch_id'); - $table->string('family_hash')->nullable()->index(); - $table->boolean('should_display_on_index')->default(true); - $table->string('type', 20); - $table->longText('content'); - $table->dateTime('created_at')->nullable(); - - $table->unique('uuid'); - $table->index('batch_id'); - $table->index(['type', 'should_display_on_index']); - }); - - $this->schema->create('telescope_entries_tags', function (Blueprint $table) { - $table->uuid('entry_uuid'); - $table->string('tag'); - - $table->index(['entry_uuid', 'tag']); - $table->index('tag'); - - $table->foreign('entry_uuid') - ->references('uuid') - ->on('telescope_entries') - ->onDelete('cascade'); - }); - - $this->schema->create('telescope_monitoring', function (Blueprint $table) { - $table->string('tag'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - $this->schema->dropIfExists('telescope_entries_tags'); - $this->schema->dropIfExists('telescope_entries'); - $this->schema->dropIfExists('telescope_monitoring'); - } -} diff --git a/database/migrations/2019_03_20_181657_create_users_table.php b/database/migrations/2019_03_20_181657_create_users_table.php deleted file mode 100644 index 1194e768..00000000 --- a/database/migrations/2019_03_20_181657_create_users_table.php +++ /dev/null @@ -1,34 +0,0 @@ -bigIncrements('id'); - $table->string('name'); - $table->string('password'); - $table->rememberToken(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('users'); - } -} diff --git a/database/migrations/2020_10_10_191546_add_latitude-longitude_columns.php b/database/migrations/2020_10_10_191546_add_latitude-longitude_columns.php deleted file mode 100644 index fc3e01cb..00000000 --- a/database/migrations/2020_10_10_191546_add_latitude-longitude_columns.php +++ /dev/null @@ -1,34 +0,0 @@ -float('latitude')->nullable(); - $table->float('longitude')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('places', function (Blueprint $table) { - $table->dropColumn('latitude'); - $table->dropColumn('longitude'); - }); - } -} diff --git a/database/migrations/2020_10_16_153324_remove_location_column.php b/database/migrations/2020_10_16_153324_remove_location_column.php deleted file mode 100644 index fdeb7b03..00000000 --- a/database/migrations/2020_10_16_153324_remove_location_column.php +++ /dev/null @@ -1,21 +0,0 @@ -dropColumn('location'); - $table->dropColumn('polygon'); - }); - } -} diff --git a/database/migrations/2022_02_27_182404_remove_notes_searchable_tsvector.php b/database/migrations/2022_02_27_182404_remove_notes_searchable_tsvector.php deleted file mode 100644 index c152a5d1..00000000 --- a/database/migrations/2022_02_27_182404_remove_notes_searchable_tsvector.php +++ /dev/null @@ -1,34 +0,0 @@ -id(); - $table->string('uid'); - $table->string('name'); - $table->string('service_name')->nullable(); - $table->string('service_url')->nullable(); - $table->string('service_photo')->nullable(); - $table->string('user_name')->nullable(); - $table->string('user_url')->nullable(); - $table->string('user_photo')->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('syndication_targets'); - } -}; diff --git a/database/migrations/2022_10_26_180903_add_mastodon_syndication_url.php b/database/migrations/2022_10_26_180903_add_mastodon_syndication_url.php deleted file mode 100644 index 48c4403e..00000000 --- a/database/migrations/2022_10_26_180903_add_mastodon_syndication_url.php +++ /dev/null @@ -1,32 +0,0 @@ -string('mastodon_url')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('notes', function (Blueprint $table) { - $table->dropColumn('mastodon_url'); - }); - } -}; diff --git a/database/migrations/2022_11_21_184127_remove_old_failed_jobs_table.php b/database/migrations/2022_11_21_184127_remove_old_failed_jobs_table.php deleted file mode 100644 index 9c2cc1d8..00000000 --- a/database/migrations/2022_11_21_184127_remove_old_failed_jobs_table.php +++ /dev/null @@ -1,27 +0,0 @@ -id(); - $table->string('uuid')->unique(); - $table->text('connection'); - $table->text('queue'); - $table->longText('payload'); - $table->longText('exception'); - $table->timestamp('failed_at')->useCurrent(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('failed_jobs'); - } -}; diff --git a/database/schema/pgsql-schema.sql b/database/schema/pgsql-schema.sql new file mode 100644 index 00000000..6dae72e5 --- /dev/null +++ b/database/schema/pgsql-schema.sql @@ -0,0 +1,1312 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 14.4 (Debian 14.4-1.pgdg110+1) +-- Dumped by pg_dump version 14.6 (Ubuntu 14.6-1.pgdg22.04+1) + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +SET default_table_access_method = heap; + +-- +-- Name: articles; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.articles ( + id integer NOT NULL, + titleurl character varying(50) NOT NULL, + url character varying(120), + title character varying(255) NOT NULL, + main text NOT NULL, + published smallint DEFAULT '0'::smallint NOT NULL, + created_at timestamp(0) without time zone, + updated_at timestamp(0) without time zone, + deleted_at timestamp(0) without time zone +); + + +-- +-- Name: articles_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.articles_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: articles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.articles_id_seq OWNED BY public.articles.id; + + +-- +-- Name: bookmark_tag; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.bookmark_tag ( + id integer NOT NULL, + bookmark_id integer NOT NULL, + tag_id integer NOT NULL, + created_at timestamp(0) without time zone, + updated_at timestamp(0) without time zone +); + + +-- +-- Name: bookmark_tag_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.bookmark_tag_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: bookmark_tag_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.bookmark_tag_id_seq OWNED BY public.bookmark_tag.id; + + +-- +-- Name: bookmarks; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.bookmarks ( + id integer NOT NULL, + url character varying(255) NOT NULL, + name character varying(255), + content text, + screenshot uuid, + archive character varying(255), + syndicates jsonb, + created_at timestamp(0) without time zone, + updated_at timestamp(0) without time zone +); + + +-- +-- Name: bookmarks_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.bookmarks_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: bookmarks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.bookmarks_id_seq OWNED BY public.bookmarks.id; + + +-- +-- Name: clients; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.clients ( + id integer NOT NULL, + client_url character varying(255) NOT NULL, + client_name character varying(255) NOT NULL, + created_at timestamp(0) without time zone, + updated_at timestamp(0) without time zone +); + + +-- +-- Name: clients_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.clients_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: clients_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.clients_id_seq OWNED BY public.clients.id; + + +-- +-- Name: contacts; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.contacts ( + id integer NOT NULL, + nick character varying(255) NOT NULL, + name character varying(255) NOT NULL, + homepage character varying(255), + twitter character varying(255), + created_at timestamp(0) without time zone, + updated_at timestamp(0) without time zone, + facebook character varying(255) +); + + +-- +-- Name: contacts_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.contacts_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: contacts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.contacts_id_seq OWNED BY public.contacts.id; + + +-- +-- Name: failed_jobs; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.failed_jobs ( + id bigint NOT NULL, + uuid character varying(255) NOT NULL, + connection text NOT NULL, + queue text NOT NULL, + payload text NOT NULL, + exception text NOT NULL, + failed_at timestamp(0) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL +); + + +-- +-- Name: failed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.failed_jobs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: failed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.failed_jobs_id_seq OWNED BY public.failed_jobs.id; + + +-- +-- Name: indie_web_users; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.indie_web_users ( + id integer NOT NULL, + me character varying(255) NOT NULL, + token text, + syntax character varying(255) DEFAULT 'json'::character varying NOT NULL, + syndication jsonb, + "mediaEndpoint" character varying(255), + created_at timestamp(0) without time zone, + updated_at timestamp(0) without time zone +); + + +-- +-- Name: indie_web_users_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.indie_web_users_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: indie_web_users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.indie_web_users_id_seq OWNED BY public.indie_web_users.id; + + +-- +-- Name: likes; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.likes ( + id integer NOT NULL, + url character varying(255) NOT NULL, + author_name character varying(255), + author_url character varying(255), + content text, + created_at timestamp(0) without time zone, + updated_at timestamp(0) without time zone +); + + +-- +-- Name: likes_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.likes_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: likes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.likes_id_seq OWNED BY public.likes.id; + + +-- +-- Name: media; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.media ( + id integer NOT NULL, + model_type character varying(255) NOT NULL, + model_id bigint NOT NULL, + collection_name character varying(255) NOT NULL, + name character varying(255) NOT NULL, + file_name character varying(255) NOT NULL, + disk character varying(255) NOT NULL, + size integer NOT NULL, + manipulations text NOT NULL, + custom_properties text NOT NULL, + order_column integer, + created_at timestamp(0) without time zone, + updated_at timestamp(0) without time zone +); + + +-- +-- Name: media_endpoint; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.media_endpoint ( + id integer NOT NULL, + token text, + path character varying(255) NOT NULL, + type character varying(255) NOT NULL, + note_id integer, + created_at timestamp(0) without time zone, + updated_at timestamp(0) without time zone, + image_widths text +); + + +-- +-- Name: media_endpoint_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.media_endpoint_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: media_endpoint_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.media_endpoint_id_seq OWNED BY public.media_endpoint.id; + + +-- +-- Name: media_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.media_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: media_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.media_id_seq OWNED BY public.media.id; + + +-- +-- Name: migrations; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.migrations ( + id integer NOT NULL, + migration character varying(255) NOT NULL, + batch integer NOT NULL +); + + +-- +-- Name: migrations_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.migrations_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: migrations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.migrations_id_seq OWNED BY public.migrations.id; + + +-- +-- Name: note_tag; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.note_tag ( + id integer NOT NULL, + note_id integer NOT NULL, + tag_id integer NOT NULL +); + + +-- +-- Name: note_tag_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.note_tag_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: note_tag_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.note_tag_id_seq OWNED BY public.note_tag.id; + + +-- +-- Name: notes; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.notes ( + id integer NOT NULL, + note text, + in_reply_to character varying(255), + shorturl character varying(20), + location character varying(255), + photo smallint, + tweet_id character varying(255), + client_id character varying(255), + created_at timestamp(0) without time zone, + updated_at timestamp(0) without time zone, + deleted_at timestamp(0) without time zone, + place_id integer, + facebook_url character varying(255), + swarm_url character varying(255), + instagram_url character varying(255), + mastodon_url character varying(255) +); + + +-- +-- Name: notes_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.notes_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.notes_id_seq OWNED BY public.notes.id; + + +-- +-- Name: personal_access_tokens; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.personal_access_tokens ( + id bigint NOT NULL, + tokenable_type character varying(255) NOT NULL, + tokenable_id bigint NOT NULL, + name character varying(255) NOT NULL, + token character varying(64) NOT NULL, + abilities text, + last_used_at timestamp(0) without time zone, + expires_at timestamp(0) without time zone, + created_at timestamp(0) without time zone, + updated_at timestamp(0) without time zone +); + + +-- +-- Name: personal_access_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.personal_access_tokens_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: personal_access_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.personal_access_tokens_id_seq OWNED BY public.personal_access_tokens.id; + + +-- +-- Name: places; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.places ( + id integer NOT NULL, + name character varying(255) NOT NULL, + slug character varying(255) NOT NULL, + description text, + created_at timestamp(0) without time zone, + updated_at timestamp(0) without time zone, + icon character varying(255), + foursquare character varying(255), + external_urls jsonb, + latitude double precision, + longitude double precision +); + + +-- +-- Name: places_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.places_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: places_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.places_id_seq OWNED BY public.places.id; + + +-- +-- Name: syndication_targets; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.syndication_targets ( + id bigint NOT NULL, + uid character varying(255) NOT NULL, + name character varying(255) NOT NULL, + service_name character varying(255), + service_url character varying(255), + service_photo character varying(255), + user_name character varying(255), + user_url character varying(255), + user_photo character varying(255), + created_at timestamp(0) without time zone, + updated_at timestamp(0) without time zone +); + + +-- +-- Name: syndication_targets_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.syndication_targets_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: syndication_targets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.syndication_targets_id_seq OWNED BY public.syndication_targets.id; + + +-- +-- Name: tags; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.tags ( + id integer NOT NULL, + tag character varying(255) NOT NULL, + created_at timestamp(0) without time zone, + updated_at timestamp(0) without time zone +); + + +-- +-- Name: tags_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.tags_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.tags_id_seq OWNED BY public.tags.id; + + +-- +-- Name: telescope_entries; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.telescope_entries ( + sequence bigint NOT NULL, + uuid uuid NOT NULL, + batch_id uuid NOT NULL, + family_hash character varying(255), + should_display_on_index boolean DEFAULT true NOT NULL, + type character varying(20) NOT NULL, + content text NOT NULL, + created_at timestamp(0) without time zone +); + + +-- +-- Name: telescope_entries_sequence_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.telescope_entries_sequence_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: telescope_entries_sequence_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.telescope_entries_sequence_seq OWNED BY public.telescope_entries.sequence; + + +-- +-- Name: telescope_entries_tags; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.telescope_entries_tags ( + entry_uuid uuid NOT NULL, + tag character varying(255) NOT NULL +); + + +-- +-- Name: telescope_monitoring; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.telescope_monitoring ( + tag character varying(255) NOT NULL +); + + +-- +-- Name: users; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.users ( + id bigint NOT NULL, + name character varying(255) NOT NULL, + password character varying(255) NOT NULL, + remember_token character varying(100), + created_at timestamp(0) without time zone, + updated_at timestamp(0) without time zone +); + + +-- +-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.users_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id; + + +-- +-- Name: webmentions; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.webmentions ( + id integer NOT NULL, + source character varying(255) NOT NULL, + target character varying(255) NOT NULL, + commentable_id integer, + commentable_type character varying(255), + type character varying(255), + content text, + verified smallint DEFAULT '1'::smallint NOT NULL, + created_at timestamp(0) without time zone, + updated_at timestamp(0) without time zone, + deleted_at timestamp(0) without time zone, + mf2 jsonb +); + + +-- +-- Name: webmentions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.webmentions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: webmentions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.webmentions_id_seq OWNED BY public.webmentions.id; + + +-- +-- Name: articles id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.articles ALTER COLUMN id SET DEFAULT nextval('public.articles_id_seq'::regclass); + + +-- +-- Name: bookmark_tag id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.bookmark_tag ALTER COLUMN id SET DEFAULT nextval('public.bookmark_tag_id_seq'::regclass); + + +-- +-- Name: bookmarks id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.bookmarks ALTER COLUMN id SET DEFAULT nextval('public.bookmarks_id_seq'::regclass); + + +-- +-- Name: clients id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.clients ALTER COLUMN id SET DEFAULT nextval('public.clients_id_seq'::regclass); + + +-- +-- Name: contacts id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.contacts ALTER COLUMN id SET DEFAULT nextval('public.contacts_id_seq'::regclass); + + +-- +-- Name: failed_jobs id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.failed_jobs ALTER COLUMN id SET DEFAULT nextval('public.failed_jobs_id_seq'::regclass); + + +-- +-- Name: indie_web_users id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.indie_web_users ALTER COLUMN id SET DEFAULT nextval('public.indie_web_users_id_seq'::regclass); + + +-- +-- Name: likes id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.likes ALTER COLUMN id SET DEFAULT nextval('public.likes_id_seq'::regclass); + + +-- +-- Name: media id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.media ALTER COLUMN id SET DEFAULT nextval('public.media_id_seq'::regclass); + + +-- +-- Name: media_endpoint id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.media_endpoint ALTER COLUMN id SET DEFAULT nextval('public.media_endpoint_id_seq'::regclass); + + +-- +-- Name: migrations id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.migrations ALTER COLUMN id SET DEFAULT nextval('public.migrations_id_seq'::regclass); + + +-- +-- Name: note_tag id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.note_tag ALTER COLUMN id SET DEFAULT nextval('public.note_tag_id_seq'::regclass); + + +-- +-- Name: notes id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.notes ALTER COLUMN id SET DEFAULT nextval('public.notes_id_seq'::regclass); + + +-- +-- Name: personal_access_tokens id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.personal_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.personal_access_tokens_id_seq'::regclass); + + +-- +-- Name: places id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.places ALTER COLUMN id SET DEFAULT nextval('public.places_id_seq'::regclass); + + +-- +-- Name: syndication_targets id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.syndication_targets ALTER COLUMN id SET DEFAULT nextval('public.syndication_targets_id_seq'::regclass); + + +-- +-- Name: tags id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.tags ALTER COLUMN id SET DEFAULT nextval('public.tags_id_seq'::regclass); + + +-- +-- Name: telescope_entries sequence; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.telescope_entries ALTER COLUMN sequence SET DEFAULT nextval('public.telescope_entries_sequence_seq'::regclass); + + +-- +-- Name: users id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass); + + +-- +-- Name: webmentions id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.webmentions ALTER COLUMN id SET DEFAULT nextval('public.webmentions_id_seq'::regclass); + + +-- +-- Name: articles articles_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.articles + ADD CONSTRAINT articles_pkey PRIMARY KEY (id); + + +-- +-- Name: articles articles_titleurl_unique; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.articles + ADD CONSTRAINT articles_titleurl_unique UNIQUE (titleurl); + + +-- +-- Name: bookmark_tag bookmark_tag_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.bookmark_tag + ADD CONSTRAINT bookmark_tag_pkey PRIMARY KEY (id); + + +-- +-- Name: bookmarks bookmarks_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.bookmarks + ADD CONSTRAINT bookmarks_pkey PRIMARY KEY (id); + + +-- +-- Name: clients clients_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.clients + ADD CONSTRAINT clients_pkey PRIMARY KEY (id); + + +-- +-- Name: contacts contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.contacts + ADD CONSTRAINT contacts_pkey PRIMARY KEY (id); + + +-- +-- Name: failed_jobs failed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.failed_jobs + ADD CONSTRAINT failed_jobs_pkey PRIMARY KEY (id); + + +-- +-- Name: failed_jobs failed_jobs_uuid_unique; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.failed_jobs + ADD CONSTRAINT failed_jobs_uuid_unique UNIQUE (uuid); + + +-- +-- Name: indie_web_users indie_web_users_me_unique; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.indie_web_users + ADD CONSTRAINT indie_web_users_me_unique UNIQUE (me); + + +-- +-- Name: indie_web_users indie_web_users_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.indie_web_users + ADD CONSTRAINT indie_web_users_pkey PRIMARY KEY (id); + + +-- +-- Name: likes likes_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.likes + ADD CONSTRAINT likes_pkey PRIMARY KEY (id); + + +-- +-- Name: media_endpoint media_endpoint_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.media_endpoint + ADD CONSTRAINT media_endpoint_pkey PRIMARY KEY (id); + + +-- +-- Name: media media_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.media + ADD CONSTRAINT media_pkey PRIMARY KEY (id); + + +-- +-- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.migrations + ADD CONSTRAINT migrations_pkey PRIMARY KEY (id); + + +-- +-- Name: note_tag note_tag_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.note_tag + ADD CONSTRAINT note_tag_pkey PRIMARY KEY (id); + + +-- +-- Name: notes notes_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.notes + ADD CONSTRAINT notes_pkey PRIMARY KEY (id); + + +-- +-- Name: personal_access_tokens personal_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.personal_access_tokens + ADD CONSTRAINT personal_access_tokens_pkey PRIMARY KEY (id); + + +-- +-- Name: personal_access_tokens personal_access_tokens_token_unique; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.personal_access_tokens + ADD CONSTRAINT personal_access_tokens_token_unique UNIQUE (token); + + +-- +-- Name: places places_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.places + ADD CONSTRAINT places_pkey PRIMARY KEY (id); + + +-- +-- Name: places places_slug_unique; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.places + ADD CONSTRAINT places_slug_unique UNIQUE (slug); + + +-- +-- Name: syndication_targets syndication_targets_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.syndication_targets + ADD CONSTRAINT syndication_targets_pkey PRIMARY KEY (id); + + +-- +-- Name: tags tags_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.tags + ADD CONSTRAINT tags_pkey PRIMARY KEY (id); + + +-- +-- Name: telescope_entries telescope_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.telescope_entries + ADD CONSTRAINT telescope_entries_pkey PRIMARY KEY (sequence); + + +-- +-- Name: telescope_entries telescope_entries_uuid_unique; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.telescope_entries + ADD CONSTRAINT telescope_entries_uuid_unique UNIQUE (uuid); + + +-- +-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.users + ADD CONSTRAINT users_pkey PRIMARY KEY (id); + + +-- +-- Name: webmentions webmentions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.webmentions + ADD CONSTRAINT webmentions_pkey PRIMARY KEY (id); + + +-- +-- Name: media_endpoint_token_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX media_endpoint_token_index ON public.media_endpoint USING btree (token); + + +-- +-- Name: media_model_type_model_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX media_model_type_model_id_index ON public.media USING btree (model_type, model_id); + + +-- +-- Name: personal_access_tokens_tokenable_type_tokenable_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX personal_access_tokens_tokenable_type_tokenable_id_index ON public.personal_access_tokens USING btree (tokenable_type, tokenable_id); + + +-- +-- Name: places_external_urls_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX places_external_urls_index ON public.places USING btree (external_urls); + + +-- +-- Name: telescope_entries_batch_id_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX telescope_entries_batch_id_index ON public.telescope_entries USING btree (batch_id); + + +-- +-- Name: telescope_entries_family_hash_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX telescope_entries_family_hash_index ON public.telescope_entries USING btree (family_hash); + + +-- +-- Name: telescope_entries_tags_entry_uuid_tag_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX telescope_entries_tags_entry_uuid_tag_index ON public.telescope_entries_tags USING btree (entry_uuid, tag); + + +-- +-- Name: telescope_entries_tags_tag_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX telescope_entries_tags_tag_index ON public.telescope_entries_tags USING btree (tag); + + +-- +-- Name: telescope_entries_type_should_display_on_index_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX telescope_entries_type_should_display_on_index_index ON public.telescope_entries USING btree (type, should_display_on_index); + + +-- +-- Name: webmentions_mf2_index; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX webmentions_mf2_index ON public.webmentions USING btree (mf2); + + +-- +-- Name: bookmark_tag bookmark_tag_bookmark_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.bookmark_tag + ADD CONSTRAINT bookmark_tag_bookmark_id_foreign FOREIGN KEY (bookmark_id) REFERENCES public.bookmarks(id); + + +-- +-- Name: bookmark_tag bookmark_tag_tag_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.bookmark_tag + ADD CONSTRAINT bookmark_tag_tag_id_foreign FOREIGN KEY (tag_id) REFERENCES public.tags(id); + + +-- +-- Name: media_endpoint media_endpoint_note_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.media_endpoint + ADD CONSTRAINT media_endpoint_note_id_foreign FOREIGN KEY (note_id) REFERENCES public.notes(id); + + +-- +-- Name: note_tag note_tag_note_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.note_tag + ADD CONSTRAINT note_tag_note_id_foreign FOREIGN KEY (note_id) REFERENCES public.notes(id) ON DELETE CASCADE; + + +-- +-- Name: note_tag note_tag_tag_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.note_tag + ADD CONSTRAINT note_tag_tag_id_foreign FOREIGN KEY (tag_id) REFERENCES public.tags(id); + + +-- +-- Name: notes notes_place_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.notes + ADD CONSTRAINT notes_place_id_foreign FOREIGN KEY (place_id) REFERENCES public.places(id); + + +-- +-- Name: telescope_entries_tags telescope_entries_tags_entry_uuid_foreign; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.telescope_entries_tags + ADD CONSTRAINT telescope_entries_tags_entry_uuid_foreign FOREIGN KEY (entry_uuid) REFERENCES public.telescope_entries(uuid) ON DELETE CASCADE; + + +-- +-- PostgreSQL database dump complete +-- + +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 14.4 (Debian 14.4-1.pgdg110+1) +-- Dumped by pg_dump version 14.6 (Ubuntu 14.6-1.pgdg22.04+1) + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +-- +-- Data for Name: migrations; Type: TABLE DATA; Schema: public; Owner: - +-- + +COPY public.migrations (id, migration, batch) FROM stdin; +1 2015_02_28_132629_create_articles_table 1 +2 2015_02_28_144939_create_notes_table 1 +3 2015_03_02_084342_create_tags_table 1 +4 2015_03_02_084956_create_note_tag_table 1 +5 2015_03_02_105623_create_contacts_table 1 +6 2015_03_02_114340_create_web_mentions_table 1 +7 2015_07_17_111512_create_clients_table 1 +8 2015_10_08_155111_create_media_table 1 +9 2015_11_07_130637_create_places_table 1 +10 2015_11_19_221933_add_place_relation_to_notes 1 +11 2016_07_29_113150_add_jsonb_mf2_column_to_webmentions_table 1 +12 2016_09_30_214651_cascade_delete_note_tags 1 +13 2016_10_26_170858_add_facebook_url_column_to_notes 1 +14 2016_11_23_154939_add_facebook_to_contacts 1 +15 2016_12_05_204035_add_search_to_notes 1 +16 2016_12_28_160024_add_icon_to_places 1 +17 2017_03_09_155908_create_media_endpoint_table 1 +18 2017_03_28_130855_create_indie_web_users_table 1 +19 2017_04_25_203734_update_notes_table_add_swarm_url 1 +20 2017_05_12_135451_update_places_table_add_foursquare_column 1 +21 2017_06_11_193737_update_notes_table_add_instagram_url 1 +22 2017_06_27_164743_update_places_table_add_external_urls 1 +23 2017_08_09_181357_allow_empty_note_content 1 +24 2017_09_15_081131_update_media_endpoint_table_add_nullable_image_width_column 1 +25 2017_09_16_191741_create_likes_table 1 +26 2017_10_07_163425_create_bookmarks_table 1 +27 2017_10_07_164651_create_bookmark_tag_pivot_table 1 +28 2017_12_19_160117_update_models_reference_in_webmentions_table 1 +29 2018_08_08_100000_create_telescope_entries_table 1 +30 2019_03_20_181657_create_users_table 1 +31 2019_12_14_000001_create_personal_access_tokens_table 1 +32 2020_10_10_191546_add_latitude-longitude_columns 1 +33 2020_10_16_153324_remove_location_column 1 +34 2022_02_27_182404_remove_notes_searchable_tsvector 1 +35 2022_10_21_155721_create_syndication_targets_table 1 +36 2022_10_26_180903_add_mastodon_syndication_url 1 +37 2022_11_21_184127_remove_old_failed_jobs_table 1 +38 2022_11_21_185719_create_failed_jobs_table 1 +\. + + +-- +-- Name: migrations_id_seq; Type: SEQUENCE SET; Schema: public; Owner: - +-- + +SELECT pg_catalog.setval('public.migrations_id_seq', 38, true); + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/database/seeders/ArticlesTableSeeder.php b/database/seeders/ArticlesTableSeeder.php index c61fa8b6..cbfd7a36 100644 --- a/database/seeders/ArticlesTableSeeder.php +++ b/database/seeders/ArticlesTableSeeder.php @@ -10,11 +10,9 @@ use Illuminate\Support\Facades\DB; class ArticlesTableSeeder extends Seeder { /** - * Run the database seeds. - * - * @return void + * Seed the articles table. */ - public function run() + public function run(): void { $now = Carbon::now()->subMonth()->subDays(5); $articleFirst = Article::create([ diff --git a/database/seeders/BookmarksTableSeeder.php b/database/seeders/BookmarksTableSeeder.php index 8e06aaca..baa3580f 100644 --- a/database/seeders/BookmarksTableSeeder.php +++ b/database/seeders/BookmarksTableSeeder.php @@ -9,11 +9,9 @@ use Illuminate\Database\Seeder; class BookmarksTableSeeder extends Seeder { /** - * Run the database seeds. - * - * @return void + * Seed the bookmarks table. */ - public function run() + public function run(): void { Bookmark::factory(10) ->has(Tag::factory()->count(1)) diff --git a/database/seeders/ClientsTableSeeder.php b/database/seeders/ClientsTableSeeder.php index 82a49f41..35dcb296 100644 --- a/database/seeders/ClientsTableSeeder.php +++ b/database/seeders/ClientsTableSeeder.php @@ -10,11 +10,9 @@ use Illuminate\Support\Facades\DB; class ClientsTableSeeder extends Seeder { /** - * Run the database seeds. - * - * @return void + * Seed the clients table. */ - public function run() + public function run(): void { DB::table('clients')->insert([ 'client_url' => 'https://jbl5.dev/notes/new', diff --git a/database/seeders/ContactsTableSeeder.php b/database/seeders/ContactsTableSeeder.php index 4ca526c5..328a039c 100644 --- a/database/seeders/ContactsTableSeeder.php +++ b/database/seeders/ContactsTableSeeder.php @@ -9,11 +9,9 @@ use Illuminate\FileSystem\FileSystem; class ContactsTableSeeder extends Seeder { /** - * Run the database seeds. - * - * @return void + * Seed the contacts table. */ - public function run() + public function run(): void { Contact::create([ 'nick' => 'tantek', diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index f4bad136..5117a89d 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -7,11 +7,9 @@ use Illuminate\Database\Seeder; class DatabaseSeeder extends Seeder { /** - * Run the database seeds. - * - * @return void + * Seed the application's database. */ - public function run() + public function run(): void { $this->call(ArticlesTableSeeder::class); $this->call(ClientsTableSeeder::class); diff --git a/database/seeders/LikesTableSeeder.php b/database/seeders/LikesTableSeeder.php index f01b4df0..dc6a36f3 100644 --- a/database/seeders/LikesTableSeeder.php +++ b/database/seeders/LikesTableSeeder.php @@ -11,11 +11,9 @@ use Illuminate\Support\Facades\DB; class LikesTableSeeder extends Seeder { /** - * Run the database seeds. - * - * @return void + * Seed the likes table. */ - public function run() + public function run(): void { Like::factory(10)->create(); diff --git a/database/seeders/NotesTableSeeder.php b/database/seeders/NotesTableSeeder.php index 7218b219..13b1a470 100644 --- a/database/seeders/NotesTableSeeder.php +++ b/database/seeders/NotesTableSeeder.php @@ -13,11 +13,9 @@ use SplFileInfo; class NotesTableSeeder extends Seeder { /** - * Run the database seeds. - * - * @return void + * Seed the notes table. */ - public function run() + public function run(): void { $now = Carbon::now()->subDays(rand(2, 5)); $noteTwitterReply = Note::create([ diff --git a/database/seeders/PlacesTableSeeder.php b/database/seeders/PlacesTableSeeder.php index 6bd7bc3c..44cb266f 100644 --- a/database/seeders/PlacesTableSeeder.php +++ b/database/seeders/PlacesTableSeeder.php @@ -8,11 +8,9 @@ use Illuminate\Database\Seeder; class PlacesTableSeeder extends Seeder { /** - * Run the database seeds. - * - * @return void + * Seed the places table. */ - public function run() + public function run(): void { $place = new Place(); $place->name = 'The Bridgewater Pub'; diff --git a/database/seeders/UsersTableSeeder.php b/database/seeders/UsersTableSeeder.php index bc03d593..d9e608e2 100644 --- a/database/seeders/UsersTableSeeder.php +++ b/database/seeders/UsersTableSeeder.php @@ -8,11 +8,9 @@ use Illuminate\Support\Facades\DB; class UsersTableSeeder extends Seeder { /** - * Run the database seeds. - * - * @return void + * Seed the users table. */ - public function run() + public function run(): void { DB::table('users')->insert([ 'name' => 'jonny', diff --git a/database/seeders/WebMentionsTableSeeder.php b/database/seeders/WebMentionsTableSeeder.php index d116b9c7..eb16e249 100644 --- a/database/seeders/WebMentionsTableSeeder.php +++ b/database/seeders/WebMentionsTableSeeder.php @@ -8,11 +8,9 @@ use Illuminate\Database\Seeder; class WebMentionsTableSeeder extends Seeder { /** - * Run the database seeds. - * - * @return void + * Seed the webmentions table. */ - public function run() + public function run(): void { // WebMention Aaron WebMention::create([ diff --git a/routes/api.php b/routes/api.php index ae7df4d5..c9b0b965 100644 --- a/routes/api.php +++ b/routes/api.php @@ -8,11 +8,11 @@ use Illuminate\Http\Request; |-------------------------------------------------------------------------- | | Here is where you can register API routes for your application. These -| routes are loaded by the RouteServiceProvider within a group which -| is assigned the "api" middleware group. Enjoy building your API! +| routes are loaded by the RouteServiceProvider and all of them will +| be assigned to the "api" middleware group. Make something great! | */ -/*Route::middleware('auth:api')->get('/user', function (Request $request) { +/*Route::middleware('auth:sanctum')->get('/user', function (Request $request) { return $request->user(); });*/ diff --git a/routes/web.php b/routes/web.php index f721a2df..2a536f10 100644 --- a/routes/web.php +++ b/routes/web.php @@ -6,8 +6,8 @@ |-------------------------------------------------------------------------- | | Here is where you can register web routes for your application. These -| routes are loaded by the RouteServiceProvider within a group which -| contains the "web" middleware group. Now create something great! +| routes are loaded by the RouteServiceProvider and all of them will +| be assigned to the "web" middleware group. Make something great! | */ diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index 547152f6..cc683011 100644 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -3,15 +3,14 @@ namespace Tests; use Illuminate\Contracts\Console\Kernel; +use Illuminate\Foundation\Application; trait CreatesApplication { /** * Creates the application. - * - * @return \Illuminate\Foundation\Application */ - public function createApplication() + public function createApplication(): Application { $app = require __DIR__.'/../bootstrap/app.php'; diff --git a/tests/Feature/Admin/AdminTest.php b/tests/Feature/Admin/AdminTest.php index 2d3f8f70..77c0ab08 100644 --- a/tests/Feature/Admin/AdminTest.php +++ b/tests/Feature/Admin/AdminTest.php @@ -10,7 +10,7 @@ use Tests\TestCase; class AdminTest extends TestCase { /** @test */ - public function adminPageRedirectsUnauthedUsersToLoginPage(): void + public function adminPageRedirectsUnauthorisedUsersToLoginPage(): void { $response = $this->get('/admin'); $response->assertRedirect('/login'); diff --git a/tests/TestToken.php b/tests/TestToken.php index 1e9e7c42..5b54d497 100644 --- a/tests/TestToken.php +++ b/tests/TestToken.php @@ -7,7 +7,7 @@ use Lcobucci\JWT\Configuration; trait TestToken { - public function getToken() + public function getToken(): string { $config = $this->app->make(Configuration::class); @@ -20,7 +20,7 @@ trait TestToken ->toString(); } - public function getTokenWithIncorrectScope() + public function getTokenWithIncorrectScope(): string { $config = $this->app->make(Configuration::class);