Merge pull request #209 from jonnybarnes/l8

Laravel 8 Upgrade
This commit is contained in:
Jonny Barnes 2020-10-19 19:57:08 +01:00 committed by GitHub
commit 1dd5cdd327
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
62 changed files with 1372 additions and 1278 deletions

View file

@ -21,7 +21,7 @@ class Kernel extends ConsoleKernel
/**
* Define the application's command schedule.
*
* @param Schedule $schedule
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)

View file

@ -46,6 +46,7 @@ class Handler extends ExceptionHandler
* @param Throwable $throwable
* @return void
* @throws Exception
* @throws Throwable
*/
public function report(Throwable $throwable)
{

View file

@ -37,16 +37,6 @@ class ShortURLsController extends Controller
return redirect('https://twitter.com/jonnybarnes');
}
/**
* Redirect from '/+' to a Google+ profile.
*
* @return RedirectResponse
*/
public function googlePlus(): RedirectResponse
{
return redirect('https://plus.google.com/u/0/117317270900655269082/about');
}
/**
* Redirect a short url of this site out to a long one based on post type.
* Further redirects may happen.

View file

@ -14,8 +14,10 @@ class Kernel extends HttpKernel
* @var array
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\App\Http\Middleware\CheckForMaintenanceMode::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
@ -42,8 +44,8 @@ class Kernel extends HttpKernel
],
'api' => [
'throttle:60,1',
'bindings',
'throttle:api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
@ -57,10 +59,10 @@ class Kernel extends HttpKernel
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
@ -68,20 +70,4 @@ class Kernel extends HttpKernel
'myauth' => \App\Http\Middleware\MyAuthMiddleware::class,
'cors' => \App\Http\Middleware\CorsHeaders::class,
];
/**
* The priority-sorted list of middleware.
*
* This forces non-global middleware to always be in the given order.
*
* @var array
*/
protected $middlewarePriority = [
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\Authenticate::class,
\Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\Illuminate\Auth\Middleware\Authorize::class,
];
}

View file

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
class PreventRequestsDuringMaintenance extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array
*/
protected $except = [
//
];
}

View file

@ -2,12 +2,11 @@
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
/**
* @codeCoverageIgnore
*/
class RedirectIfAuthenticated
{
/**
@ -15,13 +14,17 @@ class RedirectIfAuthenticated
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @param string|null ...$guards
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
public function handle(Request $request, Closure $next, ...$guards)
{
if (Auth::guard($guard)->check()) {
return redirect('/home');
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
}
}
return $next($request);

View file

@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array
*/
public function hosts()
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}

View file

@ -7,6 +7,7 @@ namespace App\Models;
use Eloquent;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Carbon;
@ -42,6 +43,8 @@ use Illuminate\Support\Carbon;
*/
class Bookmark extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*

View file

@ -7,6 +7,7 @@ namespace App\Models;
use App\Traits\FilterHtml;
use Eloquent;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;
use Illuminate\Support\Carbon;
@ -37,6 +38,7 @@ use Mf2;
class Like extends Model
{
use FilterHtml;
use HasFactory;
protected $fillable = ['url'];

View file

@ -7,6 +7,7 @@ namespace App\Models;
use Eloquent;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Carbon;
@ -33,6 +34,8 @@ use Illuminate\Support\Carbon;
*/
class MicropubClient extends Model
{
use HasFactory;
/**
* The table associated with the model.
*

View file

@ -10,7 +10,7 @@ use Eloquent;
use Exception;
use GuzzleHttp\Client;
use Illuminate\Database\Eloquent\Relations\{BelongsTo, BelongsToMany, HasMany, MorphMany};
use Illuminate\Database\Eloquent\{Builder, Collection, Model, SoftDeletes};
use Illuminate\Database\Eloquent\{Builder, Collection, Factories\HasFactory, Model, SoftDeletes};
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Cache;
use Jonnybarnes\IndieWeb\Numbers;
@ -88,6 +88,7 @@ use Spatie\CommonMarkHighlighter\{FencedCodeRenderer, IndentedCodeRenderer};
*/
class Note extends Model
{
use HasFactory;
use Searchable;
use SoftDeletes;

View file

@ -7,7 +7,7 @@ namespace App\Models;
use Cviebrock\EloquentSluggable\Sluggable;
use Eloquent;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\{Builder, Collection, Model};
use Illuminate\Database\Eloquent\{Builder, Collection, Factories\HasFactory, Model};
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
@ -51,6 +51,7 @@ use Illuminate\Support\Str;
*/
class Place extends Model
{
use HasFactory;
use Sluggable;
/**

View file

@ -7,6 +7,7 @@ namespace App\Models;
use Eloquent;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Carbon;
@ -33,6 +34,8 @@ use Illuminate\Support\Carbon;
*/
class Tag extends Model
{
use HasFactory;
/**
* We shall set a blacklist of non-modifiable model attributes.
*

View file

@ -6,6 +6,7 @@ namespace App\Models;
use Eloquent;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\DatabaseNotification;
use Illuminate\Notifications\DatabaseNotificationCollection;
@ -36,6 +37,7 @@ use Illuminate\Support\Carbon;
*/
class User extends Authenticatable
{
use HasFactory;
use Notifiable;
/**

View file

@ -12,7 +12,7 @@ class AuthServiceProvider extends ServiceProvider
* @var array
*/
protected $policies = [
// 'App\Model' => 'App\Policies\ModelPolicy',
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
];
/**

View file

@ -2,7 +2,10 @@
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
@ -12,9 +15,9 @@ class RouteServiceProvider extends ServiceProvider
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
* @var string|null
*/
protected $namespace = 'App\Http\Controllers';
// protected $namespace = 'App\Http\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
@ -23,51 +26,29 @@ class RouteServiceProvider extends ServiceProvider
*/
public function boot()
{
//
$this->configureRateLimiting();
parent::boot();
$this->routes(function () {
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
});
}
/**
* Define the routes for the application.
* Configure the rate limiters for the application.
*
* @return void
*/
public function map()
protected function configureRateLimiting()
{
$this->mapApiRoutes();
$this->mapWebRoutes();
//
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60);
});
}
}

View file

@ -1,7 +1,7 @@
{
"name": "jonnybarnes/jonnybarnes.uk",
"type": "project",
"description": "The code for jonnybarnes.uk, based on Laravel 5.8",
"description": "The code for jonnybarnes.uk, based on Laravel 8",
"keywords": [
"framework",
"laravel",
@ -13,18 +13,19 @@
"ext-intl": "*",
"ext-json": "*",
"ext-dom": "*",
"cviebrock/eloquent-sluggable": "~7.0",
"cviebrock/eloquent-sluggable": "^8.0",
"fideloper/proxy": "~4.0",
"guzzlehttp/guzzle": "~6.0",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"indieauth/client": "~0.1",
"intervention/image": "^2.4",
"jonnybarnes/indieweb": "~0.2",
"jonnybarnes/webmentions-parser": "~0.5",
"jublonet/codebird-php": "4.0.0-beta.1",
"laravel/framework": "^7.0",
"laravel/horizon": "^4.0",
"laravel/framework": "^8.0",
"laravel/horizon": "^5.0",
"laravel/scout": "^8.0",
"laravel/telescope": "^3.0",
"laravel/telescope": "^4.0",
"laravel/tinker": "^2.0",
"lcobucci/jwt": "^3.1",
"league/commonmark": "^1.0",
@ -32,7 +33,6 @@
"mf2/mf2": "~0.3",
"pmatseykanets/laravel-scout-postgres": "^7.0",
"predis/predis": "~1.0",
"ramsey/uuid": "^3.5",
"sensiolabs/security-checker": "^6.0",
"spatie/browsershot": "~3.0",
"spatie/commonmark-highlighter": "^2.0",
@ -42,11 +42,11 @@
"barryvdh/laravel-debugbar": "^3.0",
"barryvdh/laravel-ide-helper": "^2.6",
"beyondcode/laravel-dump-server": "^1.0",
"facade/ignition": "^2.0",
"facade/ignition": "^2.3.6",
"fzaninotto/faker": "^1.9.1",
"laravel/dusk": "^6.0",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^4.1",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.0",
"vimeo/psalm": "^3.9"
},
@ -62,12 +62,10 @@
},
"autoload": {
"psr-4": {
"App\\": "app/"
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
},
"classmap": [
"database/seeds",
"database/factories"
],
"files": [
"helpers.php"
]

1445
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -22,7 +22,7 @@ return [
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services your application utilizes. Set this in your ".env" file.
| services the application utilizes. Set this in your ".env" file.
|
*/
@ -39,7 +39,7 @@ return [
|
*/
'debug' => env('APP_DEBUG', false),
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
@ -207,6 +207,10 @@ return [
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
@ -238,6 +242,7 @@ return [
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
@ -249,6 +254,7 @@ return [
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Http' => Illuminate\Support\Facades\Http::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,

View file

@ -44,6 +44,7 @@ return [
'api' => [
'driver' => 'token',
'provider' => 'users',
'hash' => false,
],
],
@ -96,7 +97,21 @@ return [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => 10800,
];

View file

@ -39,6 +39,7 @@ return [
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
@ -73,7 +74,7 @@ return [
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'connection' => 'cache',
],
'dynamodb' => [
@ -98,6 +99,6 @@ return [
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache'),
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
];

View file

@ -46,7 +46,7 @@ return [
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
@ -66,7 +66,7 @@ return [
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
@ -91,17 +91,6 @@ return [
'prefix_indexes' => true,
],
'travis' => [
'driver' => 'pgsql',
'host' => 'localhost',
'database' => 'travis_ci_test',
'username' => 'travis',
'password' => '',
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
]
],
/*
@ -134,23 +123,23 @@ return [
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_DB', 0),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_CACHE_DB', 1),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],

View file

@ -8,8 +8,8 @@ return [
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. A "local" driver, as well as a variety of cloud
| based drivers are available for your choosing. Just store away!
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
@ -37,7 +37,7 @@ return [
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "s3", "rackspace"
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
@ -57,11 +57,12 @@ return [
's3' => [
'driver' => 's3',
'key' => env('AWS_S3_KEY'),
'secret' => env('AWS_S3_SECRET'),
'region' => env('AWS_S3_REGION'),
'bucket' => env('AWS_S3_BUCKET'),
'url' => env('AWS_S3_URL'),
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
],
'media' => [
@ -71,4 +72,19 @@ return [
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];

View file

@ -27,9 +27,11 @@ return [
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 10),
],
/*
|--------------------------------------------------------------------------
| Argon Options
@ -40,6 +42,7 @@ return [
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [
'memory' => 1024,
'threads' => 2,

View file

@ -1,6 +1,6 @@
<?php
return array(
return [
/*
|--------------------------------------------------------------------------
@ -15,6 +15,6 @@ return array(
|
*/
'driver' => 'imagick'
'driver' => 'imagick',
);
];

View file

@ -37,20 +37,20 @@ return [
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['daily'],
'channels' => ['single'],
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'level' => env('LOG_LEVEL', 'debug'),
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
],
@ -59,12 +59,12 @@ return [
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => 'critical',
'level' => env('LOG_LEVEL', 'critical'),
],
'papertrail' => [
'driver' => 'monolog',
'level' => 'debug',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => SyslogUdpHandler::class,
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
@ -83,18 +83,22 @@ return [
'syslog' => [
'driver' => 'syslog',
'level' => 'debug',
'level' => env('LOG_LEVEL', 'debug'),
],
'errorlog' => [
'driver' => 'errorlog',
'level' => 'debug',
'level' => env('LOG_LEVEL', 'debug'),
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
'slack' => env('LOG_SLACK_WEBHOOK_URL'),

View file

@ -4,45 +4,73 @@ return [
/*
|--------------------------------------------------------------------------
| Mail Driver
| Default Mailer
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
| Supported: "smtp", "sendmail", "mailgun", "ses"
*/
'default' => env('MAIL_MAILER', 'smtp'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers to be used while
| 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",
| "postmark", "log", "array"
|
*/
'driver' => env('MAIL_DRIVER', 'smtp'),
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'auth_mode' => null,
],
/*
|--------------------------------------------------------------------------
| SMTP Host Address
|--------------------------------------------------------------------------
|
| Here you may provide the host address of the SMTP server used by your
| applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries.
|
*/
'ses' => [
'transport' => 'ses',
],
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'mailgun' => [
'transport' => 'mailgun',
],
/*
|--------------------------------------------------------------------------
| SMTP Host Port
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
*/
'postmark' => [
'transport' => 'postmark',
],
'port' => env('MAIL_PORT', 587),
'sendmail' => [
'transport' => 'sendmail',
'path' => '/usr/sbin/sendmail -bs',
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
],
/*
|--------------------------------------------------------------------------
@ -54,52 +82,12 @@ return [
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
/*
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the "sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
*/
'sendmail' => '/usr/sbin/sendmail -bs',
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
@ -119,17 +107,4 @@ return [
],
],
/*
|--------------------------------------------------------------------------
| Log Channel
|--------------------------------------------------------------------------
|
| If you are using the "log" driver, you may specify the logging channel
| if you prefer to keep mail messages separate from other log entries
| for simpler reading. Otherwise, the default channel will be used.
|
*/
'log_channel' => env('MAIL_LOG_CHANNEL'),
];

View file

@ -51,11 +51,12 @@ return [
'sqs' => [
'driver' => 'sqs',
'key' => env('SQS_KEY', 'your-public-key'),
'secret' => env('SQS_SECRET', 'your-secret-key'),
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'your-queue-name'),
'region' => env('SQS_REGION', 'us-east-1'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'redis' => [
@ -80,7 +81,7 @@ return [
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database'),
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],

View file

@ -8,9 +8,9 @@ return [
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Stripe, Mailgun, SparkPost and others. This file provides a sane
| default location for this type of information, allowing packages
| to have a conventional place to find your various credentials.
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
@ -25,9 +25,9 @@ return [
],
'ses' => [
'key' => env('SES_KEY'),
'secret' => env('SES_SECRET'),
'region' => 'us-east-1',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
];

View file

@ -92,9 +92,11 @@ return [
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using the "apc" or "memcached" session drivers, you may specify a
| cache store that should be used for these sessions. This value must
| correspond with one of the application's configured cache stores.
| While using one of the framework's cache driven session backends you may
| list a cache store that should be used for these sessions. This value
| must match with one of the application's configured cache "stores".
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
@ -166,7 +168,7 @@ return [
|
*/
'secure' => env('SESSION_SECURE_COOKIE', null),
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
@ -188,12 +190,12 @@ return [
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| do not enable this as other CSRF protection services are in place.
| will set this value to "lax" since this is a secure default value.
|
| Supported: "lax", "strict"
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => null,
'same_site' => 'lax',
];

View file

@ -1,12 +1,35 @@
<?php
use App\Models\Bookmark;
use Faker\Generator as Faker;
namespace Database\Factories;
$factory->define(Bookmark::class, function (Faker $faker) {
return [
'url' => $faker->url,
'name' => $faker->sentence,
'content' => $faker->text,
];
});
use App\Models\Bookmark;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
class BookmarkFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Bookmark::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$now = Carbon::now()->subDays(rand(5, 15));
return [
'url' => $this->faker->url,
'name' => $this->faker->sentence,
'content' => $this->faker->text,
'created_at' => $now->toDateTimeString(),
'updated_at' => $now->toDateTimeString(),
];
}
}

View file

@ -1,13 +1,36 @@
<?php
use App\Models\Like;
use Faker\Generator as Faker;
namespace Database\Factories;
$factory->define(Like::class, function (Faker $faker) {
return [
'url' => $faker->url,
'author_name' => $faker->name,
'author_url' => $faker->url,
'content' => '<html><body><div class="h-entry"><div class="e-content">' . $faker->realtext() . '</div></div></body></html>',
];
});
use App\Models\Like;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
class LikeFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Like::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$now = Carbon::now()->subDays(rand(5, 15));
return [
'url' => $this->faker->url,
'author_name' => $this->faker->name,
'author_url' => $this->faker->url,
'content' => '<html><body><div class="h-entry"><div class="e-content">' . $this->faker->realtext() . '</div></div></body></html>',
'created_at' => $now->toDateTimeString(),
'updated_at' => $now->toDateTimeString(),
];
}
}

View file

@ -0,0 +1,29 @@
<?php
namespace Database\Factories;
use App\Models\MicropubClient;
use Illuminate\Database\Eloquent\Factories\Factory;
class MicropubClientFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = MicropubClient::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'client_url' => $this->faker->url,
'client_name' => $this->faker->company,
];
}
}

View file

@ -1,14 +1,33 @@
<?php
namespace Database\Factories;
use App\Models\Note;
use Faker\Generator as Faker;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
$factory->define(Note::class, function (Faker $faker) {
$now = Carbon::now()->subDays(rand(5, 15));
return [
'note' => $faker->paragraph,
'created_at' => $now,
'updated_at' => $now,
];
});
class NoteFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Note::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$now = Carbon::now()->subDays(rand(5, 15));
return [
'note' => $this->faker->paragraph,
'created_at' => $now,
'updated_at' => $now,
];
}
}

View file

@ -0,0 +1,32 @@
<?php
namespace Database\Factories;
use App\Models\Place;
use Illuminate\Database\Eloquent\Factories\Factory;
class PlaceFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Place::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->company,
'description' => $this->faker->sentence,
'latitude' => $this->faker->latitude,
'longitude' => $this->faker->longitude,
'external_urls' => $this->faker->url,
];
}
}

View file

@ -1,10 +1,28 @@
<?php
use App\Models\Tag;
use Faker\Generator as Faker;
namespace Database\Factories;
$factory->define(Tag::class, function (Faker $faker) {
return [
'tag' => $faker->word,
];
});
use App\Models\Tag;
use Illuminate\Database\Eloquent\Factories\Factory;
class TagFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Tag::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'tag' => $this->faker->word,
];
}
}

View file

@ -1,24 +1,31 @@
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
use Faker\Generator as Faker;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
$factory->define(App\Models\User::class, function (Faker $faker) {
static $password;
class UserFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = User::class;
return [
'name' => mb_strtolower($faker->firstName),
'password' => $password ?: $password = bcrypt('secret'),
'remember_token' => Str::random(10),
];
});
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->name,
'password' => bcrypt('password'),
'remember_token' => Str::random(10),
];
}
}

View file

@ -1,5 +1,7 @@
<?php
namespace Database\Seeders;
use App\Models\Article;
use Illuminate\Support\Carbon;
use Illuminate\Database\Seeder;

View file

@ -0,0 +1,21 @@
<?php
namespace Database\Seeders;
use App\Models\{Bookmark, Tag};
use Illuminate\Database\Seeder;
class BookmarksTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Bookmark::factory(10)
->has(Tag::factory()->count(1))
->create();
}
}

View file

@ -1,7 +1,11 @@
<?php
namespace Database\Seeders;
use App\Models\MicropubClient;
use Illuminate\Database\Seeder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
class ClientsTableSeeder extends Seeder
{
@ -25,5 +29,7 @@ class ClientsTableSeeder extends Seeder
'created_at' => Carbon::now()->toDateTimeString(),
'updated_at' => Carbon::now()->toDateTimeString(),
]);
MicropubClient::factory(5)->create();
}
}

View file

@ -1,5 +1,7 @@
<?php
namespace Database\Seeders;
use App\Models\Contact;
use Illuminate\Database\Seeder;
use Illuminate\FileSystem\FileSystem;

View file

@ -1,5 +1,7 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder

View file

@ -1,5 +1,7 @@
<?php
namespace Database\Seeders;
use App\Models\Like;
use Faker\Generator;
use Illuminate\Support\Carbon;
@ -15,15 +17,7 @@ class LikesTableSeeder extends Seeder
*/
public function run()
{
factory(Like::class, 10)->create()->each(function ($like) {
$now = Carbon::now()->subDays(rand(5, 15));
DB::table('likes')
->where('id', $like->id)
->update([
'created_at' => $now->toDateTimeString(),
'updated_at' => $now->toDateTimeString(),
]);
});
Like::factory(10)->create();
$now = Carbon::now()->subDays(rand(3, 6));
$faker = new Generator();

View file

@ -1,9 +1,12 @@
<?php
namespace Database\Seeders;
use Illuminate\Support\Carbon;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use App\Models\{Media, Note, Place};
use SplFileInfo;
class NotesTableSeeder extends Seeder
{
@ -205,5 +208,7 @@ EOF;
DB::table('notes')
->where('id', $noteWithLongUrl->id)
->update(['updated_at' => $now->toDateTimeString()]);
Note::factory(10)->create();
}
}

View file

@ -1,5 +1,7 @@
<?php
namespace Database\Seeders;
use App\Models\Place;
use Illuminate\Database\Seeder;
@ -20,5 +22,7 @@ class PlacesTableSeeder extends Seeder
$place->external_urls = 'https://foursquare.com/v/123435/the-bridgewater-pub';
$place->external_urls = 'https://www.openstreetmap.org/way/987654';
$place->save();
Place::factory(10)->create();
}
}

View file

@ -1,5 +1,7 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

View file

@ -1,5 +1,7 @@
<?php
namespace Database\Seeders;
use App\Models\WebMention;
use Illuminate\Database\Seeder;
@ -12,7 +14,8 @@ class WebMentionsTableSeeder extends Seeder
*/
public function run()
{
$webmentionAaron = WebMention::create([
// WebMention Aaron
WebMention::create([
'source' => 'https://aaronpk.localhost/reply/1',
'target' => config('app.url') . '/notes/E',
'commentable_id' => '14',
@ -20,7 +23,8 @@ class WebMentionsTableSeeder extends Seeder
'type' => 'in-reply-to',
'mf2' => '{"rels": [], "items": [{"type": ["h-entry"], "properties": {"url": ["https://aaronpk.localhost/reply/1"], "name": ["Hi too"], "author": [{"type": ["h-card"], "value": "Aaron Parecki", "properties": {"url": ["https://aaronpk.localhost"], "name": ["Aaron Parecki"], "photo": ["https://aaronparecki.com/images/profile.jpg"]}}], "content": [{"html": "Hi too", "value": "Hi too"}], "published": ["' . date(DATE_W3C) . '"], "in-reply-to": ["https://aaronpk.loclahost/reply/1", "' . config('app.url') .'/notes/E"]}}]}'
]);
$webmentionTantek = WebMention::create([
// WebMention Tantek
WebMention::create([
'source' => 'http://tantek.com/',
'target' => config('app.url') . '/notes/D',
'commentable_id' => '13',

View file

@ -1,29 +0,0 @@
<?php
use Illuminate\Support\Carbon;
use App\Models\{Bookmark, Tag};
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class BookmarksTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
factory(Bookmark::class, 10)->create()->each(function ($bookmark) {
$bookmark->tags()->save(factory(Tag::class)->make());
$now = Carbon::now()->subDays(rand(2, 12));
DB::table('bookmarks')
->where('id', $bookmark->id)
->update([
'created_at' => $now->toDateTimeString(),
'updated_at' => $now->toDateTimeString(),
]);
});
}
}

View file

@ -1,60 +1,55 @@
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylor@laravel.com>
*/
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Check If Application Is Under Maintenance
|--------------------------------------------------------------------------
|
| If the application is maintenance / demo mode via the "down" command we
| will require this file so that any prerendered template can be shown
| instead of starting the framework, which could cause an exception.
|
*/
if (file_exists(__DIR__ . '/../storage/framework/maintenance.php')) {
require __DIR__ . '/../storage/framework/maintenance.php';
}
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
| this application. We just need to utilize it! We'll simply require it
| into the script here so we don't need to manually load our classes.
|
*/
require __DIR__.'/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
require __DIR__ . '/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$app = require_once __DIR__ . '/../bootstrap/app.php';
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$kernel = $app->make(Kernel::class);
$response->send();
$response = tap($kernel->handle(
$request = Request::capture()
))->send();
$kernel->terminate($request, $response);

View file

@ -1,5 +1,7 @@
<?php
use Illuminate\Support\Facades\Broadcast;
/*
|--------------------------------------------------------------------------
| Broadcast Channels
@ -11,6 +13,6 @@
|
*/
Broadcast::channel('App.User.{id}', function ($user, $id) {
Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
return (int) $user->id === (int) $id;
});

View file

@ -1,6 +1,7 @@
<?php
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
/*
|--------------------------------------------------------------------------

View file

@ -11,10 +11,32 @@
|
*/
use App\Http\Controllers\Admin\ArticlesController as AdminArticlesController;
use App\Http\Controllers\Admin\ClientsController;
use App\Http\Controllers\Admin\ContactsController as AdminContactsController;
use App\Http\Controllers\Admin\HomeController;
use App\Http\Controllers\Admin\LikesController as AdminLikesController;
use App\Http\Controllers\Admin\NotesController as AdminNotesController;
use App\Http\Controllers\Admin\PlacesController as AdminPlacesController;
use App\Http\Controllers\ArticlesController;
use App\Http\Controllers\AuthController;
use App\Http\Controllers\BookmarksController;
use App\Http\Controllers\ContactsController;
use App\Http\Controllers\FeedsController;
use App\Http\Controllers\FrontPageController;
use App\Http\Controllers\LikesController;
use App\Http\Controllers\MicropubController;
use App\Http\Controllers\MicropubMediaController;
use App\Http\Controllers\NotesController;
use App\Http\Controllers\PlacesController;
use App\Http\Controllers\SearchController;
use App\Http\Controllers\ShortURLsController;
use App\Http\Controllers\TokenEndpointController;
use App\Http\Controllers\WebMentionsController;
use Illuminate\Support\Facades\Route;
Route::group(['domain' => config('url.longurl')], function () {
Route::get('/', 'FrontPageController@index');
Route::get('/', [FrontPageController::class, 'index']);
// Static project page
Route::view('projects', 'projects');
@ -23,12 +45,12 @@ Route::group(['domain' => config('url.longurl')], function () {
Route::view('colophon', 'colophon');
// The login routes to get authd for admin
Route::get('login', 'AuthController@showLogin')->name('login');
Route::post('login', 'AuthController@login');
Route::get('login', [AuthController::class, 'showLogin'])->name('login');
Route::post('login', [AuthController::class, 'login']);
// And the logout routes
Route::get('logout', 'AuthController@showLogout')->name('logout');
Route::post('logout', 'AuthController@logout');
Route::get('logout', [AuthController::class, 'showLogout'])->name('logout');
Route::post('logout', [AuthController::class, 'logout']);
// Admin pages grouped for filter
Route::group([
@ -36,149 +58,146 @@ Route::group(['domain' => config('url.longurl')], function () {
'namespace' => 'Admin',
'prefix' => 'admin',
], function () {
Route::get('/', 'HomeController@welcome');
Route::get('/', [HomeController::class, 'welcome']);
//Articles
Route::group(['prefix' => 'blog'], function () {
Route::get('/', 'ArticlesController@index');
Route::get('/create', 'ArticlesController@create');
Route::post('/', 'ArticlesController@store');
Route::get('/{id}/edit', 'ArticlesController@edit');
Route::put('/{id}', 'ArticlesController@update');
Route::delete('/{id}', 'ArticlesController@destroy');
Route::get('/', [AdminArticlesController::class, 'index']);
Route::get('/create', [AdminArticlesController::class, 'create']);
Route::post('/', [AdminArticlesController::class, 'store']);
Route::get('/{id}/edit', [AdminArticlesController::class, 'edit']);
Route::put('/{id}', [AdminArticlesController::class, 'update']);
Route::delete('/{id}', [AdminArticlesController::class, 'destroy']);
});
// Notes
Route::group(['prefix' => 'notes'], function () {
Route::get('/', 'NotesController@index');
Route::get('/create', 'NotesController@create');
Route::post('/', 'NotesController@store');
Route::get('/{id}/edit', 'NotesController@edit');
Route::put('/{id}', 'NotesController@update');
Route::delete('/{id}', 'NotesController@destroy');
Route::get('/', [AdminNotesController::class, 'index']);
Route::get('/create', [AdminNotesController::class, 'create']);
Route::post('/', [AdminNotesController::class, 'store']);
Route::get('/{id}/edit', [AdminNotesController::class, 'edit']);
Route::put('/{id}', [AdminNotesController::class, 'update']);
Route::delete('/{id}', [AdminNotesController::class, 'destroy']);
});
// Micropub Clients
Route::group(['prefix' => 'clients'], function () {
Route::get('/', 'ClientsController@index');
Route::get('/create', 'ClientsController@create');
Route::post('/', 'ClientsController@store');
Route::get('/{id}/edit', 'ClientsController@edit');
Route::put('/{id}', 'ClientsController@update');
Route::delete('/{id}', 'ClientsController@destroy');
Route::get('/', [ClientsController::class, 'index']);
Route::get('/create', [ClientsController::class, 'create']);
Route::post('/', [ClientsController::class, 'store']);
Route::get('/{id}/edit', [ClientsController::class, 'edit']);
Route::put('/{id}', [ClientsController::class, 'update']);
Route::delete('/{id}', [ClientsController::class, 'destroy']);
});
// Contacts
Route::group(['prefix' => 'contacts'], function () {
Route::get('/', 'ContactsController@index');
Route::get('/create', 'ContactsController@create');
Route::post('/', 'ContactsController@store');
Route::get('/{id}/edit', 'ContactsController@edit');
Route::put('/{id}', 'ContactsController@update');
Route::delete('/{id}', 'ContactsController@destroy');
Route::get('/{id}/getavatar', 'ContactsController@getAvatar');
Route::get('/', [AdminContactsController::class, 'index']);
Route::get('/create', [AdminContactsController::class, 'create']);
Route::post('/', [AdminContactsController::class, 'store']);
Route::get('/{id}/edit', [AdminContactsController::class, 'edit']);
Route::put('/{id}', [AdminContactsController::class, 'update']);
Route::delete('/{id}', [AdminContactsController::class, 'destroy']);
Route::get('/{id}/getavatar', [AdminContactsController::class, 'getAvatar']);
});
// Places
Route::group(['prefix' => 'places'], function () {
Route::get('/', 'PlacesController@index');
Route::get('/create', 'PlacesController@create');
Route::post('/', 'PlacesController@store');
Route::get('/{id}/edit', 'PlacesController@edit');
Route::put('/{id}', 'PlacesController@update');
Route::get('/{id}/merge', 'PlacesController@mergeIndex');
Route::get('/{place1_id}/merge/{place2_id}', 'PlacesController@mergeEdit');
Route::post('/merge', 'PlacesController@mergeStore');
Route::delete('/{id}', 'PlacesController@destroy');
Route::get('/', [AdminPlacesController::class, 'index']);
Route::get('/create', [AdminPlacesController::class, 'create']);
Route::post('/', [AdminPlacesController::class, 'store']);
Route::get('/{id}/edit', [AdminPlacesController::class, 'edit']);
Route::put('/{id}', [AdminPlacesController::class, 'update']);
Route::get('/{id}/merge', [AdminPlacesController::class, 'mergeIndex']);
Route::get('/{place1_id}/merge/{place2_id}', [AdminPlacesController::class, 'mergeEdit']);
Route::post('/merge', [AdminPlacesController::class, 'mergeStore']);
Route::delete('/{id}', [AdminPlacesController::class, 'destroy']);
});
// Likes
Route::group(['prefix' => 'likes'], function () {
Route::get('/', 'LikesController@index');
Route::get('/create', 'LikesController@create');
Route::post('/', 'LikesController@store');
Route::get('/{id}/edit', 'LikesController@edit');
Route::put('/{id}', 'LikesController@update');
Route::delete('/{id}', 'LikesController@destroy');
Route::get('/', [AdminLikesController::class, 'index']);
Route::get('/create', [AdminLikesController::class, 'create']);
Route::post('/', [AdminLikesController::class, 'store']);
Route::get('/{id}/edit', [AdminLikesController::class, 'edit']);
Route::put('/{id}', [AdminLikesController::class, 'update']);
Route::delete('/{id}', [AdminLikesController::class, 'destroy']);
});
});
// Blog pages using ArticlesController
Route::group(['prefix' => 'blog'], function () {
Route::get('/feed.rss', 'FeedsController@blogRss');
Route::get('/feed.atom', 'FeedsController@blogAtom');
Route::get('/feed.json', 'FeedsController@blogJson');
Route::get('/feed.jf2', 'Feedscontroller@blogJf2');
Route::get('/s/{id}', 'ArticlesController@onlyIdInURL');
Route::get('/{year?}/{month?}', 'ArticlesController@index');
Route::get('/{year}/{month}/{slug}', 'ArticlesController@show');
Route::get('/feed.rss', [FeedsController::class, 'blogRss']);
Route::get('/feed.atom', [FeedsController::class, 'blogAtom']);
Route::get('/feed.json', [FeedsController::class, 'blogJson']);
Route::get('/feed.jf2', [Feedscontroller::class, 'blogJf2']);
Route::get('/s/{id}', [ArticlesController::class, 'onlyIdInURL']);
Route::get('/{year?}/{month?}', [ArticlesController::class, 'index']);
Route::get('/{year}/{month}/{slug}', [ArticlesController::class, 'show']);
});
// Notes pages using NotesController
Route::group(['prefix' => 'notes'], function () {
Route::get('/', 'NotesController@index');
Route::get('/feed.rss', 'FeedsController@notesRss');
Route::get('/feed.atom', 'FeedsController@notesAtom');
Route::get('/feed.json', 'FeedsController@notesJson');
Route::get('/feed.jf2', 'FeedsController@notesJf2');
Route::get('/{id}', 'NotesController@show');
Route::get('/tagged/{tag}', 'NotesController@tagged');
Route::get('/', [NotesController::class, 'index']);
Route::get('/feed.rss', [FeedsController::class, 'notesRss']);
Route::get('/feed.atom', [FeedsController::class, 'notesAtom']);
Route::get('/feed.json', [FeedsController::class, 'notesJson']);
Route::get('/feed.jf2', [FeedsController::class, 'notesJf2']);
Route::get('/{id}', [NotesController::class, 'show']);
Route::get('/tagged/{tag}', [NotesController::class, 'tagged']);
});
Route::get('note/{id}', 'NotesController@redirect'); // for legacy note URLs
Route::get('note/{id}', [NotesController::class, 'redirect']); // for legacy note URLs
// Likes
Route::group(['prefix' => 'likes'], function () {
Route::get('/', 'LikesController@index');
Route::get('/{like}', 'LikesController@show');
Route::get('/', [LikesController::class, 'index']);
Route::get('/{like}', [LikesController::class, 'show']);
});
// Bookmarks
Route::group(['prefix' => 'bookmarks'], function () {
Route::get('/', 'BookmarksController@index');
Route::get('/{bookmark}', 'BookmarksController@show');
Route::get('/', [BookmarksController::class, 'index']);
Route::get('/{bookmark}', [BookmarksController::class, 'show']);
});
// Token Endpoint
Route::post('api/token', 'TokenEndpointController@create');
Route::post('api/token', [TokenEndpointController::class, 'create']);
// Micropub Endpoints
Route::get('api/post', 'MicropubController@get')->middleware('micropub.token');
Route::post('api/post', 'MicropubController@post')->middleware('micropub.token');
Route::get('api/media', 'MicropubMediaController@getHandler')->middleware('micropub.token');
Route::post('api/media', 'MicropubMediaController@media')
Route::get('api/post', [MicropubController::class, 'get'])->middleware('micropub.token');
Route::post('api/post', [MicropubController::class, 'post'])->middleware('micropub.token');
Route::get('api/media', [MicropubMediaController::class, 'getHandler'])->middleware('micropub.token');
Route::post('api/media', [MicropubMediaController:: class, 'media'])
->middleware('micropub.token', 'cors')
->name('media-endpoint');
Route::options('/api/media', 'MicropubMediaController@mediaOptionsResponse')->middleware('cors');
Route::options('/api/media', [MicropubMediaController::class, 'mediaOptionsResponse'])->middleware('cors');
// Webmention
Route::get('webmention', 'WebMentionsController@get');
Route::post('webmention', 'WebMentionsController@receive');
Route::get('webmention', [WebMentionsController::class, 'get']);
Route::post('webmention', [WebMentionsController::class, 'receive']);
// Contacts
Route::get('contacts', 'ContactsController@index');
Route::get('contacts/{contact:nick}', 'ContactsController@show');
Route::get('contacts', [ContactsController::class, 'index']);
Route::get('contacts/{contact:nick}', [ContactsController::class, 'show']);
// Places
Route::get('places', 'PlacesController@index');
Route::get('places/{place}', 'PlacesController@show');
Route::get('places', [PlacesController::class, 'index']);
Route::get('places/{place}', [PlacesController::class, 'show']);
Route::get('search', 'SearchController@search');
Route::post('update-colour-scheme', 'SessionStoreController@saveColour');
Route::get('search', [SearchController::class, 'search']);
});
// Short URL
Route::group(['domain' => config('url.shorturl')], function () {
Route::get('/', 'ShortURLsController@baseURL');
Route::get('@', 'ShortURLsController@twitter');
Route::get('+', 'ShortURLsController@googlePlus');
Route::get('/', [ShortURLsController::class, 'baseURL']);
Route::get('@', [ShortURLsController::class, 'twitter']);
Route::get('{type}/{id}', 'ShortURLsController@expandType')->where(
Route::get('{type}/{id}', [ShortURLsController::class, 'expandType'])->where(
[
'type' => '[bt]',
'id' => '[0-9A-HJ-NP-Z_a-km-z]+',
]
);
Route::get('h/{id}', 'ShortURLsController@redirect');
Route::get('h/{id}', [ShortURLsController::class, 'redirect']);
});

View file

@ -12,7 +12,7 @@ class AdminHomeControllerTest extends TestCase
public function test_admin_homepage()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)
->get('/admin');

View file

@ -13,7 +13,7 @@ class ArticlesTest extends TestCase
public function test_index_page()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)
->get('/admin/blog');
@ -22,7 +22,7 @@ class ArticlesTest extends TestCase
public function test_create_page()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)
->get('/admin/blog/create');
@ -31,7 +31,7 @@ class ArticlesTest extends TestCase
public function test_create_new_article()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$this->actingAs($user)
->post('/admin/blog', [
@ -43,7 +43,7 @@ class ArticlesTest extends TestCase
public function test_create_new_article_with_upload()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$faker = \Faker\Factory::create();
$text = $faker->text;
if ($fh = fopen(sys_get_temp_dir() . '/article.md', 'w')) {
@ -67,7 +67,7 @@ class ArticlesTest extends TestCase
public function test_see_edit_form()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)
->get('/admin/blog/1/edit');
@ -76,7 +76,7 @@ class ArticlesTest extends TestCase
public function test_edit_article()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$this->actingAs($user)
->post('/admin/blog/1', [
@ -92,7 +92,7 @@ class ArticlesTest extends TestCase
public function test_delete_article()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$this->actingAs($user)
->post('/admin/blog/1', [

View file

@ -12,7 +12,7 @@ class ClientsTest extends TestCase
public function test_index_page()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)
->get('/admin/clients');
@ -21,7 +21,7 @@ class ClientsTest extends TestCase
public function test_create_page()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)
->get('/admin/clients/create');
@ -30,7 +30,7 @@ class ClientsTest extends TestCase
public function test_create_new_client()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$this->actingAs($user)
->post('/admin/clients', [
@ -45,7 +45,7 @@ class ClientsTest extends TestCase
public function test_see_edit_form()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)
->get('/admin/clients/1/edit');
@ -54,7 +54,7 @@ class ClientsTest extends TestCase
public function test_edit_client()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$this->actingAs($user)
->post('/admin/clients/1', [
@ -70,7 +70,7 @@ class ClientsTest extends TestCase
public function test_delete_client()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$this->actingAs($user)
->post('/admin/clients/1', [

View file

@ -27,7 +27,7 @@ class ContactsTest extends TestCase
public function test_index_page()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)->get('/admin/contacts');
$response->assertViewIs('admin.contacts.index');
@ -35,7 +35,7 @@ class ContactsTest extends TestCase
public function test_create_page()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)->get('/admin/contacts/create');
$response->assertViewIs('admin.contacts.create');
@ -43,7 +43,7 @@ class ContactsTest extends TestCase
public function test_create_new_contact()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$this->actingAs($user)->post('/admin/contacts', [
'name' => 'Fred Bloggs',
@ -59,7 +59,7 @@ class ContactsTest extends TestCase
public function test_see_edit_form()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)->get('/admin/contacts/1/edit');
$response->assertViewIs('admin.contacts.edit');
@ -67,7 +67,7 @@ class ContactsTest extends TestCase
public function test_update_contact_no_uploaded_avatar()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$this->actingAs($user)->post('/admin/contacts/1', [
'_method' => 'PUT',
@ -87,7 +87,7 @@ class ContactsTest extends TestCase
copy(__DIR__ . '/../../aaron.png', sys_get_temp_dir() . '/tantek.png');
$path = sys_get_temp_dir() . '/tantek.png';
$file = new UploadedFile($path, 'tantek.png', 'image/png', null, true);
$user = factory(User::class)->create();
$user = User::factory()->make();
$this->actingAs($user)->post('/admin/contacts/1', [
'_method' => 'PUT',
@ -105,7 +105,7 @@ class ContactsTest extends TestCase
public function test_delete_contact()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$this->actingAs($user)->post('/admin/contacts/1', [
'_method' => 'DELETE',
@ -130,7 +130,7 @@ HTML;
$handler = HandlerStack::create($mock);
$client = new Client(['handler' => $handler]);
$this->app->instance(Client::class, $client);
$user = factory(User::class)->create();
$user = User::factory()->make();
$this->actingAs($user)->get('/admin/contacts/1/getavatar');
@ -148,7 +148,7 @@ HTML;
$handler = HandlerStack::create($mock);
$client = new Client(['handler' => $handler]);
$this->app->instance(Client::class, $client);
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)->get('/admin/contacts/1/getavatar');
@ -169,7 +169,7 @@ HTML;
$handler = HandlerStack::create($mock);
$client = new Client(['handler' => $handler]);
$this->app->instance(Client::class, $client);
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)->get('/admin/contacts/1/getavatar');
@ -182,7 +182,7 @@ HTML;
'nick' => 'fred',
'name' => 'Fred Bloggs',
]);
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)->get('/admin/contacts/' . $contact->id . '/getavatar');

View file

@ -15,7 +15,7 @@ class LikesTest extends TestCase
public function test_index_page()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)
->get('/admin/likes');
@ -24,7 +24,7 @@ class LikesTest extends TestCase
public function test_create_page()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)
->get('/admin/likes/create');
@ -34,7 +34,7 @@ class LikesTest extends TestCase
public function test_create_new_like()
{
Queue::fake();
$user = factory(User::class)->create();
$user = User::factory()->make();
$this->actingAs($user)
->post('/admin/likes', [
@ -48,7 +48,7 @@ class LikesTest extends TestCase
public function test_see_edit_form()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)
->get('/admin/likes/1/edit');
@ -58,7 +58,7 @@ class LikesTest extends TestCase
public function test_edit_like()
{
Queue::fake();
$user = factory(User::class)->create();
$user = User::factory()->make();
$this->actingAs($user)
->post('/admin/likes/1', [
@ -75,7 +75,7 @@ class LikesTest extends TestCase
{
$like = Like::find(1);
$url = $like->url;
$user = factory(User::class)->create();
$user = User::factory()->make();
$this->actingAs($user)
->post('/admin/likes/1', [

View file

@ -14,7 +14,7 @@ class NotesTest extends TestCase
public function test_index_page()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)->get('/admin/notes');
$response->assertViewIs('admin.notes.index');
@ -22,7 +22,7 @@ class NotesTest extends TestCase
public function test_create_page()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)->get('/admin/notes/create');
$response->assertViewIs('admin.notes.create');
@ -30,7 +30,7 @@ class NotesTest extends TestCase
public function test_create_a_new_note()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$this->actingAs($user)->post('/admin/notes', [
'content' => 'A new test note',
@ -42,7 +42,7 @@ class NotesTest extends TestCase
public function test_edit_page()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)->get('/admin/notes/1/edit');
$response->assertViewIs('admin.notes.edit');
@ -51,7 +51,7 @@ class NotesTest extends TestCase
public function test_edit_a_note()
{
Queue::fake();
$user = factory(User::class)->create();
$user = User::factory()->make();
$this->actingAs($user)->post('/admin/notes/1', [
'_method' => 'PUT',
@ -67,7 +67,7 @@ class NotesTest extends TestCase
public function test_delete_note()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$this->actingAs($user)->post('/admin/notes/1', [
'_method' => 'DELETE',

View file

@ -12,7 +12,7 @@ class PlacesTest extends TestCase
public function test_index_page()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)->get('/admin/places');
$response->assertViewIs('admin.places.index');
@ -20,7 +20,7 @@ class PlacesTest extends TestCase
public function test_create_page()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)->get('/admin/places/create');
$response->assertViewIs('admin.places.create');
@ -28,7 +28,7 @@ class PlacesTest extends TestCase
public function test_create_new_place()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$this->actingAs($user)->post('/admin/places', [
'name' => 'Test Place',
@ -44,7 +44,7 @@ class PlacesTest extends TestCase
public function test_edit_page()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$response = $this->actingAs($user)->get('/admin/places/1/edit');
$response->assertViewIs('admin.places.edit');
@ -52,7 +52,7 @@ class PlacesTest extends TestCase
public function test_updating_a_place()
{
$user = factory(User::class)->create();
$user = User::factory()->make();
$this->actingAs($user)->post('/admin/places/1', [
'_method' => 'PUT',

View file

@ -1,15 +0,0 @@
<?php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class SessionStoreControllerTest extends TestCase
{
public function test_colour_preference_saved()
{
$response = $this->post('update-colour-scheme', ['css' => 'some.css']);
$response->assertJson(['status' => 'ok']);
}
}

View file

@ -19,12 +19,6 @@ class ShortURLsControllerTest extends TestCase
$response->assertRedirect('https://twitter.com/jonnybarnes');
}
public function test_short_domain_slashplus_redirects_to_googleplus()
{
$response = $this->get('http://' . config('app.shorturl') . '/+');
$response->assertRedirect('https://plus.google.com/u/0/117317270900655269082/about');
}
public function test_short_domain_slasht_redirects_to_long_domain_slash_notes()
{
$response = $this->get('http://' . config('app.shorturl') . '/t/E');

View file

@ -64,7 +64,7 @@ class PlacesTest extends TestCase
]
]);
$this->assertInstanceOf('App\Models\Place', $ret); // a place was returned
$this->assertEquals(2, count(Place::all())); // still 2 places
$this->assertEquals(12, count(Place::all())); // still 2 places
}
public function test_service_requires_name()