2f3fd laravel 11 upgrade (#436)

* fix password reset bug

* upgrade to  laravel 11

* composer.lock

* fix migration issues

* use ValidationRule Contract

* rename password_resets table

* implemented casts as protected function

* update env variables

* fix optional property

* fix validation issues

* use <env> on php unit xml

* fix pint

* cmposer.lock

* composer json fixes

* fix composer dependencies, remove  faker

* remove unused class

* remove test class

* fix default value for mysql migration

* linting

* expression syntax fix

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
Favour Olayinka
2024-06-10 15:10:14 +01:00
committed by GitHub
parent 1875faa123
commit bec8e86b59
37 changed files with 2078 additions and 3158 deletions

View File

@@ -89,14 +89,17 @@ class Form extends Model implements CachableAttributes
'seo_meta',
];
protected $casts = [
'properties' => 'array',
'database_fields_update' => 'array',
'closes_at' => 'datetime',
'tags' => 'array',
'removed_properties' => 'array',
'seo_meta' => 'object'
];
protected function casts(): array
{
return [
'properties' => 'array',
'database_fields_update' => 'array',
'closes_at' => 'datetime',
'tags' => 'array',
'removed_properties' => 'array',
'seo_meta' => 'object'
];
}
protected $appends = [
'share_url',
@@ -129,7 +132,7 @@ class Form extends Model implements CachableAttributes
public function getIsProAttribute()
{
return $this->remember('is_pro', 15 * 60, function (): ?bool {
return optional($this->workspace)->is_pro === true;
return $this->workspace?->is_pro === true;
});
}

View File

@@ -22,9 +22,12 @@ class FormStatistic extends Model
*
* @var array
*/
protected $casts = [
'data' => 'array',
];
protected function casts(): array
{
return [
'data' => 'array',
];
}
/**
* Relationships

View File

@@ -13,9 +13,12 @@ class FormSubmission extends Model
'data',
];
protected $casts = [
'data' => 'array',
];
protected function casts(): array
{
return [
'data' => 'array',
];
}
/**
* RelationShips

View File

@@ -23,10 +23,13 @@ class FormIntegration extends Model
'oauth_id'
];
protected $casts = [
'data' => 'object',
'logic' => 'object'
];
protected function casts(): array
{
return [
'data' => 'object',
'logic' => 'object'
];
}
protected $dispatchesEvents = [
'created' => FormIntegrationCreated::class,

View File

@@ -19,9 +19,12 @@ class FormIntegrationsEvent extends Model
'data'
];
protected $casts = [
'data' => 'object'
];
protected function casts()
{
return [
'data' => 'object'
];
}
/**
* The event map for the model.

View File

@@ -20,9 +20,12 @@ class License extends Model
'meta',
];
protected $casts = [
'meta' => 'array',
];
protected function casts()
{
return [
'meta' => 'array',
];
}
public function user()
{

View File

@@ -29,15 +29,18 @@ class Template extends Model
'related_templates',
];
protected $casts = [
'structure' => 'array',
'questions' => 'array',
'industries' => 'array',
'types' => 'array',
'related_templates' => 'array',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
protected function casts()
{
return [
'structure' => 'array',
'questions' => 'array',
'industries' => 'array',
'types' => 'array',
'related_templates' => 'array',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
}
protected $attributes = [
'publicly_listed' => false,
@@ -49,7 +52,7 @@ class Template extends Model
public function getShareUrlAttribute()
{
return front_url('/form-templates/'.$this->slug);
return front_url('/form-templates/' . $this->slug);
}
public function setDescriptionAttribute($value)

View File

@@ -45,9 +45,12 @@ class User extends Authenticatable implements JWTSubject
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
protected function casts()
{
return [
'email_verified_at' => 'datetime',
];
}
/**
* The accessors to append to the model's array form.
@@ -90,12 +93,12 @@ class User extends Authenticatable implements JWTSubject
{
return $this->subscribed()
|| in_array($this->email, config('opnform.extra_pro_users_emails'))
|| ! is_null($this->activeLicense());
|| !is_null($this->activeLicense());
}
public function getHasCustomerIdAttribute()
{
return ! is_null($this->stripe_id);
return !is_null($this->stripe_id);
}
public function getAdminAttribute()

View File

@@ -32,9 +32,12 @@ class Workspace extends Model implements CachableAttributes
'is_enterprise',
];
protected $casts = [
'custom_domains' => 'array',
];
protected function casts()
{
return [
'custom_domains' => 'array',
];
}
protected $cachableAttributes = [
'is_pro',
@@ -149,7 +152,7 @@ class Workspace extends Model implements CachableAttributes
return $this->remember('is_risky', 15 * 60, function (): bool {
// A workspace is risky if all of his users are risky
foreach ($this->owners as $owner) {
if (! $owner->is_risky) {
if (!$owner->is_risky) {
return false;
}
}