Lint PHP code psr-12, add GH action

This commit is contained in:
Julien Nahum
2024-02-23 11:54:12 +01:00
parent e85e4df7fe
commit 62971a2ef4
226 changed files with 2338 additions and 2144 deletions

View File

@@ -19,7 +19,7 @@ class CreateFormsTable extends Migration
Schema::create('forms', function (Blueprint $table) use ($driver) {
$table->id();
$table->foreignIdFor(\App\Models\Workspace::class,'workspace_id');
$table->foreignIdFor(\App\Models\Workspace::class, 'workspace_id');
$table->string('title');
$table->string('slug');
$table->json('properties');
@@ -48,13 +48,13 @@ class CreateFormsTable extends Migration
$table->boolean('transparent_background')->default(false);
$table->timestamp('closes_at')->nullable();
$table->text('closed_text')->nullable();
$table->string('notification_subject')->default("We saved your answers");
$table->string('notification_subject')->default('We saved your answers');
$table->text('notification_body')->default(new Expression("('<p>Hello there 👋 <br>This is a confirmation that your submission was successfully saved.</p>')"));
$table->boolean('notifications_include_submission')->default(true);
$table->boolean('use_captcha')->default(false);
$table->boolean('can_be_indexed')->default(true);
$table->string('password')->nullable()->default(null);
$table->string('notification_sender')->default("OpenForm");
$table->string('notification_sender')->default('OpenForm');
if ($driver === 'mysql') {
$table->jsonb('tags')->default(new Expression('(JSON_ARRAY())'));
} else {

View File

@@ -19,11 +19,11 @@ class CreateFormSubmissionsTable extends Migration
Schema::create('form_submissions', function (Blueprint $table) use ($driver) {
$table->id();
$table->foreignIdFor(\App\Models\Forms\Form::class,'form_id');
$table->foreignIdFor(\App\Models\Forms\Form::class, 'form_id');
if ($driver === 'mysql') {
$table->jsonb('data')->default(new Expression("(JSON_OBJECT())"));
$table->jsonb('data')->default(new Expression('(JSON_OBJECT())'));
} else {
$table->jsonb('data')->default("{}");
$table->jsonb('data')->default('{}');
}
$table->timestamps();
});

View File

@@ -15,7 +15,7 @@ class CreateFormZapierWebhooksTable extends Migration
{
Schema::create('form_zapier_webhooks', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(\App\Models\Forms\Form::class,'form_id');
$table->foreignIdFor(\App\Models\Forms\Form::class, 'form_id');
$table->string('hook_url');
$table->softDeletes();
$table->timestamps();

View File

@@ -37,8 +37,10 @@ class CreateUsersWorkspacesTable extends Migration
echo '.';
// Make sure user wasn't deleted
if (!DB::table('users')->where('id',
$workspace->user_id)->exists()) {
if (! DB::table('users')->where(
'id',
$workspace->user_id
)->exists()) {
continue;
}
@@ -50,19 +52,19 @@ class CreateUsersWorkspacesTable extends Migration
'user_id' => $workspace->user_id,
'is_owner' => true,
'created_at' => $now,
'updated_at' => $now
'updated_at' => $now,
]);
// Set form creator id
foreach (\App\Models\Forms\Form::withTrashed()->where('workspace_id',$workspace->id)->get() as $form) {
$form->update(['creator_id'=>$workspace->user_id]);
foreach (\App\Models\Forms\Form::withTrashed()->where('workspace_id', $workspace->id)->get() as $form) {
$form->update(['creator_id' => $workspace->user_id]);
}
}
});
// Drop column
Schema::table('workspaces', function (Blueprint $table) {
$table->dropColumn(['user_id','access_token']);
$table->dropColumn(['user_id', 'access_token']);
});
Schema::table('user_workspace', function (Blueprint $table) {

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*
@@ -15,7 +14,7 @@ return new class extends Migration
{
Schema::create('form_views', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(\App\Models\Forms\Form::class,'form_id');
$table->foreignIdFor(\App\Models\Forms\Form::class, 'form_id');
$table->timestamps();
});
}

View File

@@ -6,8 +6,7 @@ use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*
@@ -19,11 +18,11 @@ return new class extends Migration
Schema::create('form_statistics', function (Blueprint $table) use ($driver) {
$table->id();
$table->foreignIdFor(\App\Models\Forms\Form::class,'form_id');
$table->foreignIdFor(\App\Models\Forms\Form::class, 'form_id');
if ($driver === 'mysql') {
$table->jsonb('data')->default(new Expression("(JSON_OBJECT())"));
$table->jsonb('data')->default(new Expression('(JSON_OBJECT())'));
} else {
$table->jsonb('data')->default("{}");
$table->jsonb('data')->default('{}');
}
$table->date('date');
});

View File

@@ -6,8 +6,7 @@ use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*
@@ -19,9 +18,9 @@ return new class extends Migration
Schema::table('forms', function (Blueprint $table) use ($driver) {
if ($driver === 'mysql') {
$table->jsonb('removed_properties')->default(new Expression("(JSON_ARRAY())"));
$table->jsonb('removed_properties')->default(new Expression('(JSON_ARRAY())'));
} else {
$table->jsonb('removed_properties')->default("[]")->nullable();
$table->jsonb('removed_properties')->default('[]')->nullable();
}
});
}

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*

View File

@@ -6,8 +6,7 @@ use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*
@@ -25,7 +24,7 @@ return new class extends Migration
$table->text('description');
$table->string('image_url');
if ($driver === 'mysql') {
$table->jsonb('structure')->default(new Expression("(JSON_OBJECT())"));
$table->jsonb('structure')->default(new Expression('(JSON_OBJECT())'));
} else {
$table->jsonb('structure')->default('{}');
}

View File

@@ -6,8 +6,7 @@ use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*
@@ -16,10 +15,10 @@ return new class extends Migration
public function up()
{
$driver = DB::getDriverName();
Schema::table('templates', function (Blueprint $table) use ($driver) {
if ($driver === 'mysql') {
$table->jsonb('questions')->default(new Expression("(JSON_ARRAY())"));
$table->jsonb('questions')->default(new Expression('(JSON_ARRAY())'));
} else {
$table->jsonb('questions')->default('[]');
}

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*

View File

@@ -5,8 +5,7 @@ use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*

View File

@@ -6,8 +6,7 @@ use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*
@@ -16,12 +15,12 @@ return new class extends Migration
public function up()
{
$driver = DB::getDriverName();
Schema::table('forms', function (Blueprint $table) use ($driver) {
if ($driver === 'mysql') {
$table->json('seo_meta')->default(new Expression("(JSON_OBJECT())"));
$table->json('seo_meta')->default(new Expression('(JSON_OBJECT())'));
} else {
$table->json('seo_meta')->default("{}");
$table->json('seo_meta')->default('{}');
}
});
}

View File

@@ -6,8 +6,7 @@ use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*
@@ -19,7 +18,7 @@ return new class extends Migration
Schema::table('forms', function (Blueprint $table) use ($driver) {
if ($driver === 'mysql') {
$table->json('notification_settings')->default(new Expression("(JSON_OBJECT())"))->nullable(true);
$table->json('notification_settings')->default(new Expression('(JSON_OBJECT())'))->nullable(true);
} else {
$table->json('notification_settings')->default('{}')->nullable(true);
}

View File

@@ -6,8 +6,7 @@ use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*
@@ -21,13 +20,13 @@ return new class extends Migration
$table->boolean('publicly_listed')->default(false);
if ($driver === 'mysql') {
$table->jsonb('industries')->default(new Expression("(JSON_ARRAY())"));
$table->jsonb('industries')->default(new Expression('(JSON_ARRAY())'));
} else {
$table->jsonb('industries')->default('[]');
}
if ($driver === 'mysql') {
$table->jsonb('types')->default(new Expression("(JSON_ARRAY())"));
$table->jsonb('types')->default(new Expression('(JSON_ARRAY())'));
} else {
$table->jsonb('types')->default('[]');
}
@@ -35,12 +34,12 @@ return new class extends Migration
$table->string('short_description')->nullable();
if ($driver === 'mysql') {
$table->jsonb('related_templates')->default(new Expression("(JSON_ARRAY())"));
$table->jsonb('related_templates')->default(new Expression('(JSON_ARRAY())'));
} else {
$table->jsonb('related_templates')->default('[]');
}
$table->string('image_url',500)->nullable()->change();
$table->string('image_url', 500)->nullable()->change();
});
}

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*
@@ -14,7 +13,7 @@ return new class extends Migration
public function up()
{
Schema::table('templates', function (Blueprint $table) {
$table->foreignIdFor(\App\Models\User::class,'creator_id')->nullable();
$table->foreignIdFor(\App\Models\User::class, 'creator_id')->nullable();
});
}

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*

View File

@@ -5,7 +5,7 @@ use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
return new class () extends Migration {
/**
* Run the migrations.
*
@@ -14,9 +14,9 @@ return new class extends Migration {
public function up()
{
$driver = DB::getDriverName();
Schema::table('workspaces', function (Blueprint $table) use ($driver){
Schema::table('workspaces', function (Blueprint $table) use ($driver) {
if ($driver === 'mysql') {
$table->json('custom_domains')->default(new Expression("(JSON_OBJECT())"))->nullable(true);
$table->json('custom_domains')->default(new Expression('(JSON_OBJECT())'))->nullable(true);
} else {
$table->json('custom_domains')->default('{}')->nullable(true);
}

View File

@@ -4,8 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
return new class () extends Migration {
/**
* Run the migrations.
*