Add type hints for Laravel 10
This commit is contained in:
@@ -45,7 +45,7 @@ class MediaMigrate extends Command
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$replace = $this->option('replace');
|
$replace = $this->option('replace');
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class MediaRebuild extends Command
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$replace = $this->option('replace');
|
$replace = $this->option('replace');
|
||||||
$all = $this->option('replace');
|
$all = $this->option('replace');
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class Kernel extends ConsoleKernel
|
|||||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule The schedule.
|
* @param \Illuminate\Console\Scheduling\Schedule $schedule The schedule.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function schedule(Schedule $schedule)
|
protected function schedule(Schedule $schedule): void
|
||||||
{
|
{
|
||||||
// $schedule->command('inspire')->hourly();
|
// $schedule->command('inspire')->hourly();
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@ class Kernel extends ConsoleKernel
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function commands()
|
protected function commands(): void
|
||||||
{
|
{
|
||||||
$this->load(__DIR__ . '/Commands');
|
$this->load(__DIR__ . '/Commands');
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class Handler extends ExceptionHandler
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function register()
|
public function register(): void
|
||||||
{
|
{
|
||||||
// $this->renderable(function (HttpException $e, $request) {
|
// $this->renderable(function (HttpException $e, $request) {
|
||||||
// if ($request->is('api/*')) {
|
// if ($request->is('api/*')) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class Authenticate extends Middleware
|
|||||||
* @param mixed $request Request.
|
* @param mixed $request Request.
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
protected function redirectTo(mixed $request)
|
protected function redirectTo(mixed $request): ?string
|
||||||
{
|
{
|
||||||
if ($request->expectsJson() === false) {
|
if ($request->expectsJson() === false) {
|
||||||
return route('login');
|
return route('login');
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ class ForceJsonResponse
|
|||||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next)
|
public function handle(Request $request, Closure $next): Response
|
||||||
{
|
{
|
||||||
$request->headers->set('Accept', 'application/json');
|
$request->headers->set('Accept', 'application/json');
|
||||||
return $next($request);
|
return $next($request);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Models\Analytics;
|
use App\Models\Analytics;
|
||||||
@@ -15,7 +16,7 @@ class LogRequest
|
|||||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next)
|
public function handle(Request $request, Closure $next): Response
|
||||||
{
|
{
|
||||||
// Make it an after middleware
|
// Make it an after middleware
|
||||||
$response = $next($request);
|
$response = $next($request);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use App\Providers\RouteServiceProvider;
|
use App\Providers\RouteServiceProvider;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -17,7 +18,7 @@ class RedirectIfAuthenticated
|
|||||||
* @param string|null ...$guards Guards.
|
* @param string|null ...$guards Guards.
|
||||||
* @return Response|RedirectResponse
|
* @return Response|RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next, ...$guards)
|
public function handle(Request $request, Closure $next, string ...$guards): Response
|
||||||
{
|
{
|
||||||
$guards = empty($guards) === true ? [null] : $guards;
|
$guards = empty($guards) === true ? [null] : $guards;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
@@ -15,7 +16,7 @@ class UseSanctumGuard
|
|||||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next)
|
public function handle(Request $request, Closure $next): Response
|
||||||
{
|
{
|
||||||
Auth::shouldUse('sanctum');
|
Auth::shouldUse('sanctum');
|
||||||
return $next($request);
|
return $next($request);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class AuthLoginRequest extends FormRequest
|
|||||||
*
|
*
|
||||||
* @return array<string, mixed>
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'email' => 'required|string|min:6|max:255',
|
'email' => 'required|string|min:6|max:255',
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class BaseRequest extends FormRequest
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
if (request()->isMethod('post') === true && method_exists($this, 'postAuthorize') === true) {
|
if (request()->isMethod('post') === true && method_exists($this, 'postAuthorize') === true) {
|
||||||
return $this->postAuthorize();
|
return $this->postAuthorize();
|
||||||
@@ -30,7 +30,7 @@ class BaseRequest extends FormRequest
|
|||||||
*
|
*
|
||||||
* @return array<string, mixed>
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules(): array
|
||||||
{
|
{
|
||||||
$rules = [];
|
$rules = [];
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class ContactSendRequest extends FormRequest
|
|||||||
*
|
*
|
||||||
* @return array<string, mixed>
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => 'required|max:255',
|
'name' => 'required|max:255',
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class SubscriptionRequest extends BaseRequest
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function messages()
|
public function messages(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'email.unique' => 'This email address has already subscribed',
|
'email.unique' => 'This email address has already subscribed',
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class UserForgotPasswordRequest extends FormRequest
|
|||||||
*
|
*
|
||||||
* @return array<string, mixed>
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'email' => 'required|exists:users,email',
|
'email' => 'required|exists:users,email',
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class UserRegisterRequest extends FormRequest
|
|||||||
*
|
*
|
||||||
* @return array<string, mixed>
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'display_name' => ['required','string','max:255', new Uniqueish('users')],
|
'display_name' => ['required','string','max:255', new Uniqueish('users')],
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class UserResendVerifyEmailRequest extends FormRequest
|
|||||||
*
|
*
|
||||||
* @return array<string, mixed>
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'email' => 'required|exists:users,email',
|
'email' => 'required|exists:users,email',
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class UserResetPasswordRequest extends FormRequest
|
|||||||
*
|
*
|
||||||
* @return array<string, mixed>
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'code' => 'required|digits:6',
|
'code' => 'required|digits:6',
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class UserVerifyEmailRequest extends FormRequest
|
|||||||
*
|
*
|
||||||
* @return array<string, mixed>
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'code' => 'required|digits:6',
|
'code' => 'required|digits:6',
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class MoveMediaJob implements ShouldQueue
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
// Don't continue if the media is already on the new storage disk
|
// Don't continue if the media is already on the new storage disk
|
||||||
if ($this->media->storage === $this->newStorage) {
|
if ($this->media->storage === $this->newStorage) {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class SendEmailJob implements ShouldQueue
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
Mail::to($this->to)->send($this->mailable);
|
Mail::to($this->to)->send($this->mailable);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class StoreUploadedFileJob implements ShouldQueue
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
$storageDisk = $this->media->storage;
|
$storageDisk = $this->media->storage;
|
||||||
$fileName = $this->media->name;
|
$fileName = $this->media->name;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function register()
|
public function register(): void
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot(): void
|
||||||
{
|
{
|
||||||
Storage::macro('public', function ($diskName) {
|
Storage::macro('public', function ($diskName) {
|
||||||
$public = config("filesystems.disks.{$diskName}.public", false);
|
$public = config("filesystems.disks.{$diskName}.public", false);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class AuthServiceProvider extends ServiceProvider
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot(): void
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot(): void
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@@ -39,7 +39,7 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function shouldDiscoverEvents()
|
public function shouldDiscoverEvents(): bool
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class RouteServiceProvider extends ServiceProvider
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot(): void
|
||||||
{
|
{
|
||||||
// RateLimiter::for('api', function (Request $request) {
|
// RateLimiter::for('api', function (Request $request) {
|
||||||
// return Limit::perMinute(60)->by($request->user()?->id !== null ?: $request->ip());
|
// return Limit::perMinute(60)->by($request->user()?->id !== null ?: $request->ip());
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class ArticleFactory extends Factory
|
|||||||
*
|
*
|
||||||
* @return array<string, mixed>
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
public function definition()
|
public function definition(): array
|
||||||
{
|
{
|
||||||
$publishDate = Carbon::parse($this->faker->dateTimeBetween('-1 month', '+1 month'));
|
$publishDate = Carbon::parse($this->faker->dateTimeBetween('-1 month', '+1 month'));
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class EventFactory extends Factory
|
|||||||
*
|
*
|
||||||
* @return array<string, mixed>
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
public function definition()
|
public function definition(): array
|
||||||
{
|
{
|
||||||
$startDate = Carbon::parse($this->faker->dateTimeBetween('now', '+1 year'));
|
$startDate = Carbon::parse($this->faker->dateTimeBetween('now', '+1 year'));
|
||||||
$endDate = Carbon::parse($this->faker->dateTimeBetween($startDate, '+1 year'));
|
$endDate = Carbon::parse($this->faker->dateTimeBetween($startDate, '+1 year'));
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class MediaFactory extends Factory
|
|||||||
*
|
*
|
||||||
* @return array<string, mixed>
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
public function definition()
|
public function definition(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'title' => $this->faker->sentence(),
|
'title' => $this->faker->sentence(),
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class UserFactory extends Factory
|
|||||||
*
|
*
|
||||||
* @return array<string, mixed>
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
public function definition()
|
public function definition(): array
|
||||||
{
|
{
|
||||||
$faker = \Faker\Factory::create();
|
$faker = \Faker\Factory::create();
|
||||||
$faker->addProvider(new \Faker\Provider\CustomInternetProvider($faker));
|
$faker->addProvider(new \Faker\Provider\CustomInternetProvider($faker));
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('users', function (Blueprint $table) {
|
Schema::create('users', function (Blueprint $table) {
|
||||||
$table->uuid('id')->primary();
|
$table->uuid('id')->primary();
|
||||||
@@ -33,7 +33,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('users');
|
Schema::dropIfExists('users');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('password_resets', function (Blueprint $table) {
|
Schema::create('password_resets', function (Blueprint $table) {
|
||||||
$table->string('email')->index();
|
$table->string('email')->index();
|
||||||
@@ -25,7 +25,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('password_resets');
|
Schema::dropIfExists('password_resets');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
@@ -29,7 +29,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('failed_jobs');
|
Schema::dropIfExists('failed_jobs');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
@@ -30,7 +30,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('personal_access_tokens');
|
Schema::dropIfExists('personal_access_tokens');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('posts', function (Blueprint $table) {
|
Schema::create('posts', function (Blueprint $table) {
|
||||||
$table->uuid('id')->primary();
|
$table->uuid('id')->primary();
|
||||||
@@ -30,7 +30,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('posts');
|
Schema::dropIfExists('posts');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('media', function (Blueprint $table) {
|
Schema::create('media', function (Blueprint $table) {
|
||||||
$table->uuid('id')->primary();
|
$table->uuid('id')->primary();
|
||||||
@@ -30,7 +30,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('media');
|
Schema::dropIfExists('media');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('permissions', function (Blueprint $table) {
|
Schema::create('permissions', function (Blueprint $table) {
|
||||||
$table->uuid('id')->primary();
|
$table->uuid('id')->primary();
|
||||||
@@ -28,7 +28,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('permissions');
|
Schema::dropIfExists('permissions');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('events', function (Blueprint $table) {
|
Schema::create('events', function (Blueprint $table) {
|
||||||
$table->uuid('id')->primary();
|
$table->uuid('id')->primary();
|
||||||
@@ -35,7 +35,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('events');
|
Schema::dropIfExists('events');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('subscriptions', function (Blueprint $table) {
|
Schema::create('subscriptions', function (Blueprint $table) {
|
||||||
$table->uuid('id')->primary();
|
$table->uuid('id')->primary();
|
||||||
@@ -26,7 +26,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('subscriptions');
|
Schema::dropIfExists('subscriptions');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('jobs', function (Blueprint $table) {
|
Schema::create('jobs', function (Blueprint $table) {
|
||||||
$table->bigIncrements('id');
|
$table->bigIncrements('id');
|
||||||
@@ -29,7 +29,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('jobs');
|
Schema::dropIfExists('jobs');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('user_codes', function (Blueprint $table) {
|
Schema::create('user_codes', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
@@ -30,7 +30,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('user_codes');
|
Schema::dropIfExists('user_codes');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::connection(config('audit.drivers.database.connection', config('database.default')))->create('audits', function (Blueprint $table) {
|
Schema::connection(config('audit.drivers.database.connection', config('database.default')))->create('audits', function (Blueprint $table) {
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::connection(config('audit.drivers.database.connection', config('database.default')))->drop('audits');
|
Schema::connection(config('audit.drivers.database.connection', config('database.default')))->drop('audits');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('user_logins', function (Blueprint $table) {
|
Schema::create('user_logins', function (Blueprint $table) {
|
||||||
$table->uuid('id')->primary();
|
$table->uuid('id')->primary();
|
||||||
@@ -32,7 +32,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('user_logins');
|
Schema::dropIfExists('user_logins');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('analytics', function (Blueprint $table) {
|
Schema::create('analytics', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
@@ -28,7 +28,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('analytics');
|
Schema::dropIfExists('analytics');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('attachments', function (Blueprint $table) {
|
Schema::create('attachments', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
@@ -28,7 +28,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('attachments');
|
Schema::dropIfExists('attachments');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('events', function (Blueprint $table) {
|
Schema::table('events', function (Blueprint $table) {
|
||||||
$table->string('price')->default("");
|
$table->string('price')->default("");
|
||||||
@@ -23,7 +23,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('events', function (Blueprint $table) {
|
Schema::table('events', function (Blueprint $table) {
|
||||||
$table->dropColumn('price');
|
$table->dropColumn('price');
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('events', function (Blueprint $table) {
|
Schema::table('events', function (Blueprint $table) {
|
||||||
$table->string('ages')->default("");
|
$table->string('ages')->default("");
|
||||||
@@ -23,7 +23,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('events', function (Blueprint $table) {
|
Schema::table('events', function (Blueprint $table) {
|
||||||
$table->dropColumn('ages');
|
$table->dropColumn('ages');
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
DB::table('media')->whereNull('mime')->update(['mime' => '']);
|
DB::table('media')->whereNull('mime')->update(['mime' => '']);
|
||||||
DB::table('media')->whereNull('permission')->update(['permission' => '']);
|
DB::table('media')->whereNull('permission')->update(['permission' => '']);
|
||||||
@@ -40,7 +40,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('media', function (Blueprint $table) {
|
Schema::table('media', function (Blueprint $table) {
|
||||||
$table->bigInteger('size')->change();
|
$table->bigInteger('size')->change();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
DB::table('users')->whereNull('phone')->update(['phone' => '']);
|
DB::table('users')->whereNull('phone')->update(['phone' => '']);
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->string('phone')->nullable(true)->change();
|
$table->string('phone')->nullable(true)->change();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->string('display_name')->default("");
|
$table->string('display_name')->default("");
|
||||||
@@ -31,7 +31,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->dropColumn('display_name');
|
$table->dropColumn('display_name');
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('subscriptions');
|
Schema::dropIfExists('subscriptions');
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::create('subscriptions', function (Blueprint $table) {
|
Schema::create('subscriptions', function (Blueprint $table) {
|
||||||
$table->uuid('id')->primary();
|
$table->uuid('id')->primary();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::rename('posts', 'articles');
|
Schema::rename('posts', 'articles');
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::rename('articles', 'posts');
|
Schema::rename('articles', 'posts');
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('analytics', function (Blueprint $table) {
|
Schema::table('analytics', function (Blueprint $table) {
|
||||||
$table->bigInteger('session')->nullable(false);
|
$table->bigInteger('session')->nullable(false);
|
||||||
@@ -100,7 +100,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('analytics', function (Blueprint $table) {
|
Schema::table('analytics', function (Blueprint $table) {
|
||||||
$table->dropColumn('session');
|
$table->dropColumn('session');
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->dropColumn('username');
|
$table->dropColumn('username');
|
||||||
@@ -24,7 +24,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->string('username')->unique();
|
$table->string('username')->unique();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('shortlinks', function (Blueprint $table) {
|
Schema::create('shortlinks', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
@@ -26,7 +26,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('shortlinks');
|
Schema::dropIfExists('shortlinks');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('shortlinks', function (Blueprint $table) {
|
Schema::table('shortlinks', function (Blueprint $table) {
|
||||||
$table->bigInteger('used')->default(0);
|
$table->bigInteger('used')->default(0);
|
||||||
@@ -23,7 +23,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('shortlinks', function (Blueprint $table) {
|
Schema::table('shortlinks', function (Blueprint $table) {
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->string('first_name')->default('')->change();
|
$table->string('first_name')->default('')->change();
|
||||||
@@ -24,7 +24,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->string('first_name')->nullable(false)->change();
|
$table->string('first_name')->nullable(false)->change();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('events', function (Blueprint $table) {
|
Schema::table('events', function (Blueprint $table) {
|
||||||
$table->string('location_url')->default('');
|
$table->string('location_url')->default('');
|
||||||
@@ -23,7 +23,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('events', function (Blueprint $table) {
|
Schema::table('events', function (Blueprint $table) {
|
||||||
$table->dropColumn('location_url');
|
$table->dropColumn('location_url');
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('attachments', function (Blueprint $table) {
|
Schema::table('attachments', function (Blueprint $table) {
|
||||||
$table->boolean('private')->default(false);
|
$table->boolean('private')->default(false);
|
||||||
@@ -23,7 +23,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('attachments', function (Blueprint $table) {
|
Schema::table('attachments', function (Blueprint $table) {
|
||||||
$table->dropColumn('private');
|
$table->dropColumn('private');
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('event_users', function (Blueprint $table) {
|
Schema::create('event_users', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
@@ -29,7 +29,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('event_users');
|
Schema::dropIfExists('event_users');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::rename('password_resets', 'password_reset_tokens');
|
Schema::rename('password_resets', 'password_reset_tokens');
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@ return new class extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::rename('password_reset_tokens', 'password_resets');
|
Schema::rename('password_reset_tokens', 'password_resets');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class DatabaseSeeder extends Seeder
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function run()
|
public function run(): void
|
||||||
{
|
{
|
||||||
\App\Models\User::factory(40)->create();
|
\App\Models\User::factory(40)->create();
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class ArticlesApiTest extends TestCase
|
|||||||
$this->faker = FakerFactory::create();
|
$this->faker = FakerFactory::create();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAnyUserCanViewArticle()
|
public function testAnyUserCanViewArticle(): void
|
||||||
{
|
{
|
||||||
// Create an event
|
// Create an event
|
||||||
$article = Article::factory()->create([
|
$article = Article::factory()->create([
|
||||||
@@ -51,7 +51,7 @@ class ArticlesApiTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAdminCanCreateUpdateDeleteArticle()
|
public function testAdminCanCreateUpdateDeleteArticle(): void
|
||||||
{
|
{
|
||||||
// Create a user with the admin/events permission
|
// Create a user with the admin/events permission
|
||||||
$adminUser = User::factory()->create();
|
$adminUser = User::factory()->create();
|
||||||
@@ -102,7 +102,7 @@ class ArticlesApiTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNonAdminCannotCreateUpdateDeleteArticle()
|
public function testNonAdminCannotCreateUpdateDeleteArticle(): void
|
||||||
{
|
{
|
||||||
// Create a user without admin/events permission
|
// Create a user without admin/events permission
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class AuthApiTest extends TestCase
|
|||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
|
||||||
public function testLogin()
|
public function testLogin(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->create([
|
$user = User::factory()->create([
|
||||||
'password' => bcrypt('password'),
|
'password' => bcrypt('password'),
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class ContactFormTest extends TestCase
|
|||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
|
||||||
public function testContactForm()
|
public function testContactForm(): void
|
||||||
{
|
{
|
||||||
$formData = [
|
$formData = [
|
||||||
'name' => 'John Doe',
|
'name' => 'John Doe',
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class EventsApiTest extends TestCase
|
|||||||
$this->faker = FakerFactory::create();
|
$this->faker = FakerFactory::create();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAnyUserCanViewEvent()
|
public function testAnyUserCanViewEvent(): void
|
||||||
{
|
{
|
||||||
// Create an event
|
// Create an event
|
||||||
$event = Event::factory()->create([
|
$event = Event::factory()->create([
|
||||||
@@ -52,7 +52,7 @@ class EventsApiTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAnyUserCannotSeeDraftEvent()
|
public function testAnyUserCannotSeeDraftEvent(): void
|
||||||
{
|
{
|
||||||
// Create a draft event
|
// Create a draft event
|
||||||
$draftEvent = Event::factory()->create([
|
$draftEvent = Event::factory()->create([
|
||||||
@@ -85,7 +85,7 @@ class EventsApiTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAdminCanCreateUpdateDeleteEvent()
|
public function testAdminCanCreateUpdateDeleteEvent(): void
|
||||||
{
|
{
|
||||||
// Create a user with the admin/events permission
|
// Create a user with the admin/events permission
|
||||||
$adminUser = User::factory()->create();
|
$adminUser = User::factory()->create();
|
||||||
@@ -139,7 +139,7 @@ class EventsApiTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNonAdminCannotCreateUpdateDeleteEvent()
|
public function testNonAdminCannotCreateUpdateDeleteEvent(): void
|
||||||
{
|
{
|
||||||
// Create a user without admin/events permission
|
// Create a user without admin/events permission
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class UsersApiTest extends TestCase
|
|||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
|
||||||
public function testNonAdminUsersCanOnlyViewBasicUserInfo()
|
public function testNonAdminUsersCanOnlyViewBasicUserInfo(): void
|
||||||
{
|
{
|
||||||
// create a non-admin user
|
// create a non-admin user
|
||||||
$nonAdminUser = User::factory()->create();
|
$nonAdminUser = User::factory()->create();
|
||||||
@@ -71,7 +71,7 @@ class UsersApiTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGuestCannotCreateUser()
|
public function testGuestCannotCreateUser(): void
|
||||||
{
|
{
|
||||||
$userData = [
|
$userData = [
|
||||||
'email' => 'johndoe@example.com',
|
'email' => 'johndoe@example.com',
|
||||||
@@ -85,7 +85,7 @@ class UsersApiTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGuestCanRegisterUser()
|
public function testGuestCanRegisterUser(): void
|
||||||
{
|
{
|
||||||
$userData = [
|
$userData = [
|
||||||
'first_name' => 'John',
|
'first_name' => 'John',
|
||||||
@@ -102,7 +102,7 @@ class UsersApiTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCannotCreateDuplicateEmailOrDisplayName()
|
public function testCannotCreateDuplicateEmailOrDisplayName(): void
|
||||||
{
|
{
|
||||||
$userData = [
|
$userData = [
|
||||||
'display_name' => 'JackDoe',
|
'display_name' => 'JackDoe',
|
||||||
@@ -125,7 +125,7 @@ class UsersApiTest extends TestCase
|
|||||||
$response->assertJsonValidationErrors(['display_name', 'email']);
|
$response->assertJsonValidationErrors(['display_name', 'email']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUserCanOnlyUpdateOwnUser()
|
public function testUserCanOnlyUpdateOwnUser(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ class UsersApiTest extends TestCase
|
|||||||
$response->assertStatus(403);
|
$response->assertStatus(403);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUserCannotDeleteUsers()
|
public function testUserCannotDeleteUsers(): void
|
||||||
{
|
{
|
||||||
$user = User::factory()->create();
|
$user = User::factory()->create();
|
||||||
|
|
||||||
@@ -169,7 +169,7 @@ class UsersApiTest extends TestCase
|
|||||||
$this->assertDatabaseHas('users', ['id' => $otherUser->id]);
|
$this->assertDatabaseHas('users', ['id' => $otherUser->id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAdminCanUpdateAnyUser()
|
public function testAdminCanUpdateAnyUser(): void
|
||||||
{
|
{
|
||||||
$admin = User::factory()->create();
|
$admin = User::factory()->create();
|
||||||
$admin->givePermission('admin/users');
|
$admin->givePermission('admin/users');
|
||||||
@@ -204,7 +204,7 @@ class UsersApiTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAdminCanDeleteAnyUser()
|
public function testAdminCanDeleteAnyUser(): void
|
||||||
{
|
{
|
||||||
$admin = User::factory()->create();
|
$admin = User::factory()->create();
|
||||||
$admin->givePermission('admin/users');
|
$admin->givePermission('admin/users');
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class ExampleTest extends TestCase
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function test_that_true_is_true()
|
public function test_that_true_is_true(): void
|
||||||
{
|
{
|
||||||
$this->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user