Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#405 - Laravel 11 upgrade #413

Merged
merged 29 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
75b86ab
#405 - update to Laravel 11
krzysztofrewak Mar 20, 2024
a829d4d
#405 - spatie/laravel-slack-slash-command updated
krzysztofrewak Mar 20, 2024
604c1a0
#405 - rebase
krzysztofrewak Mar 20, 2024
f145f4f
- some updates
kamilpiech97 Mar 21, 2024
761d485
Merge remote-tracking branch 'origin/laravel-11' into laravel-11
kamilpiech97 Mar 21, 2024
d82ff79
Merge branch 'main' into laravel-11
kamilpiech97 Mar 21, 2024
00c39af
Merge remote-tracking branch 'origin/main' into laravel-11
krzysztofrewak Mar 26, 2024
b01fdb0
Merge remote-tracking branch 'origin/laravel-11' into laravel-11
krzysztofrewak Mar 26, 2024
baab854
#405 - rebase
krzysztofrewak Mar 26, 2024
a34d501
#405 - restructuring
krzysztofrewak Mar 26, 2024
b916fb0
#405 - Laravel 11 slimming
krzysztofrewak Mar 26, 2024
f6d5cce
#405 - csf
krzysztofrewak Mar 26, 2024
9add072
Merge remote-tracking branch 'origin/main' into laravel-11
krzysztofrewak Mar 27, 2024
f99e134
#405 - rebase
krzysztofrewak Mar 27, 2024
be9f5bc
#405 - timezone?
krzysztofrewak Mar 27, 2024
d8ee580
#405 - more files moved
krzysztofrewak Mar 27, 2024
421988d
#405 - readme update
krzysztofrewak Mar 27, 2024
72fb588
#405 - docker-compose to docker compose
krzysztofrewak Mar 27, 2024
bfbcde3
#405 - removing rackbeat/laravel-ui-avatars
krzysztofrewak Mar 27, 2024
7e53127
#405 - composer bump
krzysztofrewak Mar 27, 2024
36555c2
- add trust proxies middleware
mtracz Mar 28, 2024
02d8d37
#405 - adding Sanctum middleware
krzysztofrewak Apr 2, 2024
132d801
#405 - deprecated annotations
krzysztofrewak Apr 2, 2024
37012d3
#405 - downgrading phpoffice/phpword
krzysztofrewak Apr 2, 2024
01e48a1
#405 - transferring exception handling
krzysztofrewak Apr 3, 2024
a3e0011
#405 - źźź
krzysztofrewak Apr 3, 2024
af658a8
#405 - updating permission namespaces
krzysztofrewak Apr 3, 2024
1a85336
#405 - csf
krzysztofrewak Apr 3, 2024
232fa7e
#405 - inertia tweaks
krzysztofrewak Apr 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions app/Domain/UiAvatar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

declare(strict_types=1);

namespace Toby\Domain;

use Stringable;

class UiAvatar implements Stringable
{
public int $length = 2;
public float $fontSize = 0.33;
public int $size = 128;
public bool $rounded = true;
public bool $uppercase = true;
public string $background = "#A0A0A0";
public string $color = "#FFFFFF";
public bool $bold = true;
public string $region = "eu";
public string $name = "";

public function __toString(): string
{
return $this->getUrl();
}

public function getUrl(): string
{
return "https://eu.ui-avatars.com/api/?" . http_build_query([
"length" => $this->length,
"font-size" => $this->fontSize,
"size" => $this->size,
"rounded" => $this->rounded ? 1 : 0,
"uppercase" => $this->uppercase ? 1 : 0,
"background" => $this->background,
"color" => $this->color,
"bold" => $this->bold ? 1 : 0,
"region" => $this->region,
"name" => $this->name,
]);
}
}
16 changes: 6 additions & 10 deletions app/Models/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Carbon;
use Rackbeat\UIAvatars\HasAvatar;
use Toby\Domain\UiAvatar;
use Toby\Enums\EmploymentForm;
use Toby\Helpers\ColorGenerator;

Expand All @@ -29,7 +29,6 @@
class Profile extends Model
{
use HasFactory;
use HasAvatar;

protected $primaryKey = "user_id";
protected $guarded = [];
Expand All @@ -51,21 +50,18 @@ public function user(): BelongsTo

public function getAvatar(): string
{
return $this->getAvatarGenerator()
->backgroundColor(ColorGenerator::generate($this->full_name))
->image();
$avatar = new UiAvatar();
$avatar->background = ColorGenerator::generate($this->full_name);
$avatar->name = mb_substr($this->first_name, 0, 1) . mb_substr($this->last_name, 0, 1);
mtracz marked this conversation as resolved.
Show resolved Hide resolved

return $avatar->getUrl();
}

public function getFullNameAttribute(): string
{
return "{$this->first_name} {$this->last_name}";
}

protected function getAvatarName(): string
{
return mb_substr($this->first_name, 0, 1) . mb_substr($this->last_name, 0, 1);
}

protected static function newFactory(): ProfileFactory
{
return ProfileFactory::new();
Expand Down
7 changes: 0 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
"description": "HR software you love to hate",
"keywords": ["toby", "laravel", "hr"],
"license": "MIT",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/laravel-shift/laravel-ui-avatars.git"
}
],
"require": {
"php": "^8.3",
"ext-pdo": "*",
Expand All @@ -27,7 +21,6 @@
"laravel/tinker": "^2.9",
"maatwebsite/excel": "^3.1",
"phpoffice/phpword": "1.1",
mtracz marked this conversation as resolved.
Show resolved Hide resolved
"rackbeat/laravel-ui-avatars": "dev-l11-compatibility",
"sentry/sentry-laravel": "^4.2",
"spatie/laravel-google-calendar": "3.8",
"spatie/laravel-model-states": "^2.6",
Expand Down
Loading
Loading