Skip to content

Commit

Permalink
Update "laravel/framework" to "10.43.16"
Browse files Browse the repository at this point in the history
  • Loading branch information
danon committed Feb 14, 2024
1 parent 3b970d3 commit 07cc996
Show file tree
Hide file tree
Showing 27 changed files with 740 additions and 1,034 deletions.
2 changes: 1 addition & 1 deletion app/Console/Commands/PurgeSessionsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private function signout(Session $session)
}

// reindex user data in elasticsearch so we can sort users by last activity date
dispatch(function () use ($user) {
dispatch_sync(function () use ($user) {
(new Crawler())->index($user);
});
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Kernel extends Foundation\Http\Kernel
];

/** @var array */
protected $routeMiddleware = [
protected $middlewareAliases = [
'auth' => Middleware\Authenticate::class,
'auth.basic' => AuthenticateWithBasicAuth::class,
'bindings' => SubstituteBindings::class,
Expand Down
2 changes: 1 addition & 1 deletion app/Listeners/JobListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function onJobSave(JobWasSaved $event)

// we need to update elasticsearch index by updating firm name and logo in all job offers
if ($event->job->firm_id && $event->job->firm->isDirty(['name', 'logo'])) {
dispatch(new UpdateJobOffers($event->job->firm_id));
dispatch_sync(new UpdateJobOffers($event->job->firm_id));
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/Listeners/PageSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private function updateTopic(Topic $topic)

private function index(Page | Model $page): void
{
dispatch(function () use ($page) {
dispatch_sync(function () use ($page) {
(new Crawler())->index($page);
});
}
Expand Down
4 changes: 2 additions & 2 deletions app/Listeners/UserSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function index(UserSaved $event)
{
$user = $event->user;

dispatch(function () use ($user) {
dispatch_sync(function () use ($user) {
(new Crawler())->index($user);
});
}
Expand All @@ -47,7 +47,7 @@ public function delete(UserDeleted $event)
{
$user = (new User())->forceFill($event->user);

dispatch(function () use ($user) {
dispatch_sync(function () use ($user) {
(new Crawler())->delete($user);
});
}
Expand Down
24 changes: 5 additions & 19 deletions app/Models/Firewall.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,16 @@
*/
class Firewall extends Model
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'firewall';

/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['expire_at', 'user_id', 'ip', 'reason', 'moderator_id', 'fingerprint'];

/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = ['created_at', 'updated_at', 'expire_at'];
protected $casts = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'expire_at' => 'datetime',
];

/**
* @var string
*/
protected $dateFormat = 'Y-m-d H:i:se';

public function user()
Expand Down
7 changes: 1 addition & 6 deletions app/Models/Flag.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,12 @@ class Flag extends Model
*/
protected $dateFormat = 'Y-m-d H:i:se';

/**
* @var string[]
*/
protected $dates = ['created_at'];

/**
* Related to Laravel 5.8. deleted_at has different date format that created_at and carbon throws exception
*
* @var string[]
*/
protected $casts = ['deleted_at' => 'string'];
protected $casts = ['deleted_at' => 'string', 'created_at' => 'datetime'];

/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
Expand Down
39 changes: 18 additions & 21 deletions app/Models/Forum.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

namespace Coyote;

use Carbon\Carbon;
use Coyote\Forum\Access;
use Coyote\Models\Scopes\TrackForum;
use Coyote\Models\Scopes\TrackTopic;
use Illuminate\Database\Eloquent\Model;

/**
Expand Down Expand Up @@ -60,27 +58,23 @@ class Forum extends Model
'enable_reputation',
'enable_anonymous',
'enable_tags',
'enable_homepage'
'enable_homepage',
];

/**
* @var array
*/
protected $casts = [
'redirects' => 'int',
'is_locked' => 'bool',
'is_prohibited' => 'bool',
'require_tag' => 'bool',
'redirects' => 'int',
'is_locked' => 'bool',
'is_prohibited' => 'bool',
'require_tag' => 'bool',
'enable_reputation' => 'bool',
'enable_anonymous' => 'bool',
'enable_prune' => 'bool'
'enable_anonymous' => 'bool',
'enable_prune' => 'bool',
'read_at' => 'datetime',
];

/**
* @var array
*/
protected $dates = ['read_at'];

/**
* @var string
*/
Expand Down Expand Up @@ -187,12 +181,12 @@ public function ability(string $name, int $userId)

if (!isset($acl[$userId])) {
$acl[$userId] = $this->permissions()
->join('permissions AS p', 'p.id', '=', 'forum_permissions.permission_id')
->join('group_users AS ug', 'ug.group_id', '=', 'forum_permissions.group_id')
->where('ug.user_id', $userId)
->orderBy('value')
->select(['name', 'value'])
->pluck('value', 'name');
->join('permissions AS p', 'p.id', '=', 'forum_permissions.permission_id')
->join('group_users AS ug', 'ug.group_id', '=', 'forum_permissions.group_id')
->where('ug.user_id', $userId)
->orderBy('value')
->select(['name', 'value'])
->pluck('value', 'name');
}

return isset($acl[$userId][$name]) ? $acl[$userId][$name] : false;
Expand All @@ -205,7 +199,10 @@ public function ability(string $name, int $userId)
public function markTime(?string $guestId)
{
if ($guestId !== null && !array_key_exists('read_at', $this->attributes)) {
$this->attributes['read_at'] = $this->tracks()->select('marked_at')->where('guest_id', $guestId)->value('marked_at');
$this->attributes['read_at'] = $this->tracks()
->select('marked_at')
->where('guest_id', $guestId)
->value('marked_at');
}

return $this->read_at;
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Forum/Track.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ class Track extends Model
/**
* @var array
*/
public $dates = ['marked_at'];
public $casts = ['marked_at' => 'datetime'];
}
11 changes: 4 additions & 7 deletions app/Models/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@ class Invoice extends Model
{
const UPDATED_AT = null;

/**
* @var array
*/
protected $fillable = ['user_id', 'name', 'number', 'vat_id', 'address', 'city', 'postal_code', 'currency_id', 'country_id'];

/**
* @var array
*/
protected $dates = ['created_at', 'updated_at'];
protected $casts = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
];

/**
* @var string
Expand Down
92 changes: 44 additions & 48 deletions app/Models/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,29 +64,29 @@ class Job extends Model
getIndexBody as parentGetIndexBody;
}

const MONTHLY = 'monthly';
const YEARLY = 'yearly';
const WEEKLY = 'weekly';
const HOURLY = 'hourly';
const MONTHLY = 'monthly';
const YEARLY = 'yearly';
const WEEKLY = 'weekly';
const HOURLY = 'hourly';

const STUDENT = 'student';
const JUNIOR = 'junior';
const MID = 'mid';
const SENIOR = 'senior';
const LEAD = 'lead';
const MANAGER = 'manager';
const STUDENT = 'student';
const JUNIOR = 'junior';
const MID = 'mid';
const SENIOR = 'senior';
const LEAD = 'lead';
const MANAGER = 'manager';

const EMPLOYMENT = 'employment';
const MANDATORY = 'mandatory';
const CONTRACT = 'contract';
const B2B = 'b2b';
const EMPLOYMENT = 'employment';
const MANDATORY = 'mandatory';
const CONTRACT = 'contract';
const B2B = 'b2b';

/**
* Filling each field adds points to job offer score.
*/
const SCORE_CONFIG = [
'job' => ['salary_from' => 25, 'salary_to' => 25, 'city' => 15, 'seniority' => 5],
'firm' => ['name' => 15, 'logo' => 5, 'website' => 1, 'description' => 5]
'job' => ['salary_from' => 25, 'salary_to' => 25, 'city' => 15, 'seniority' => 5],
'firm' => ['name' => 15, 'logo' => 5, 'website' => 1, 'description' => 5],
];

/**
Expand Down Expand Up @@ -124,14 +124,14 @@ class Job extends Model
* @var array
*/
protected $attributes = [
'enable_apply' => true,
'is_remote' => false,
'title' => '',
'remote_range' => 100,
'currency_id' => Currency::PLN,
'is_gross' => false,
'rate' => self::MONTHLY,
'employment' => self::EMPLOYMENT
'enable_apply' => true,
'is_remote' => false,
'title' => '',
'remote_range' => 100,
'currency_id' => Currency::PLN,
'is_gross' => false,
'rate' => self::MONTHLY,
'employment' => self::EMPLOYMENT,
];

/**
Expand All @@ -140,28 +140,24 @@ class Job extends Model
* @var array
*/
protected $casts = [
'is_remote' => 'boolean',
'is_boost' => 'boolean',
'is_gross' => 'boolean',
'is_publish' => 'boolean',
'is_ads' => 'boolean',
'is_highlight' => 'boolean',
'is_on_top' => 'boolean',
'plan_id' => 'int',
'score' => 'int',
'enable_apply' => 'boolean'
'is_remote' => 'boolean',
'is_boost' => 'boolean',
'is_gross' => 'boolean',
'is_publish' => 'boolean',
'is_ads' => 'boolean',
'is_highlight' => 'boolean',
'is_on_top' => 'boolean',
'plan_id' => 'int',
'score' => 'int',
'enable_apply' => 'boolean',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deadline_at' => 'datetime',
'boost_at' => 'datetime',
];

/**
* @var string
*/
protected $dateFormat = 'Y-m-d H:i:se';

/**
* @var array
*/
protected $dates = ['created_at', 'updated_at', 'deadline_at', 'boost_at'];

/**
* We need to set firm id to null offer is private
*/
Expand Down Expand Up @@ -395,7 +391,7 @@ public function comments()
*/
public function commentsWithChildren()
{
$userRelation = fn ($builder) => $builder->select(['id', 'name', 'photo', 'deleted_at', 'is_blocked', 'is_online'])->withTrashed();
$userRelation = fn($builder) => $builder->select(['id', 'name', 'photo', 'deleted_at', 'is_blocked', 'is_online'])->withTrashed();

return $this
->comments()
Expand All @@ -405,7 +401,7 @@ public function commentsWithChildren()
'children' => function ($builder) use ($userRelation) {
return $builder->orderBy('id')->with(['user' => $userRelation]);
},
'user' => $userRelation
'user' => $userRelation,
]);
}

Expand All @@ -425,15 +421,15 @@ public function setTitleAttribute($title)
*/
public function setSalaryFromAttribute($value)
{
$this->attributes['salary_from'] = $value === null ? null : (int) trim($value);
$this->attributes['salary_from'] = $value === null ? null : (int)trim($value);
}

/**
* @param string $value
*/
public function setSalaryToAttribute($value)
{
$this->attributes['salary_to'] = $value === null ? null : (int) trim($value);
$this->attributes['salary_to'] = $value === null ? null : (int)trim($value);
}

/**
Expand Down Expand Up @@ -563,9 +559,9 @@ public function monthlySalary(?float $salary): ?float
// we need to calculate monthly salary in order to sorting data by salary
if ($this->rate == self::YEARLY) {
$salary = round($salary / 12);
} elseif ($this->rate == self::WEEKLY) {
} else if ($this->rate == self::WEEKLY) {
$salary = round($salary * 4);
} elseif ($this->rate == self::HOURLY) {
} else if ($this->rate == self::HOURLY) {
$salary = round($salary * 8 * 5 * 4);
}

Expand Down
10 changes: 1 addition & 9 deletions app/Models/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,7 @@
*/
class Mail extends Model
{
const UPDATED_AT = null;

/**
* @var array
*/
protected $fillable = ['subject', 'email'];

/**
* @var array
*/
protected $dates = ['created_at'];
protected $casts = ['created_at' => 'datetime'];
}
Loading

0 comments on commit 07cc996

Please sign in to comment.