Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Commit

Permalink
Release 1.3.17
Browse files Browse the repository at this point in the history
  • Loading branch information
Quinten committed Oct 20, 2021
2 parents f1bed85 + b78046c commit e04844c
Show file tree
Hide file tree
Showing 12 changed files with 1,775 additions and 1,601 deletions.
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
analyse:
./vendor/bin/phpstan analyse

coverage:
XDEBUG_MODE=coverage ./vendor/bin/pest --coverage -p --min=80

test:
./vendor/bin/pest -p

control: analyse test
7 changes: 6 additions & 1 deletion app/Domain/SendPortal/Models/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
namespace App\Domain\SendPortal\Models;

use App\Domain\SendPortal\Facades\SendPortal;
use Illuminate\Support\Collection;

/**
* @property Collection $tags
* @property string $email
*/
class Subscriber extends BaseModel
{
/**
Expand All @@ -25,7 +30,7 @@ public static function add(string $email, string $firstname = '', string $lastna
return $subscriber;
}

public static function findByEmail(string $email)
public static function findByEmail(string $email): ?self
{
$subscribers = SendPortal::get('subscribers')['data'];

Expand Down
6 changes: 6 additions & 0 deletions app/Domain/SendPortal/Models/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@
namespace App\Domain\SendPortal\Models;

use App\Domain\SendPortal\Facades\SendPortal;
use Based\Fluent\Fluent;

class Tag extends BaseModel
{
use Fluent;

public int $id;
public string $name;

public static function findByName(string $name): ?static
{
$tags = SendPortal::get('tags')['data'];
Expand Down
10 changes: 7 additions & 3 deletions app/Http/Response/ResponseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ class ResponseFactory
AuthorResponse::class,
];

public static function createFromSlug(string $slug = null)
public static function createFromSlug(string $slug = null): BaseResponse
{
return collect(static::$responses)
$response = collect(static::$responses)
->map(fn (string $response) => new $response())
->filter(fn (BaseResponse $response) => $response->canHandleSlug($slug))
->first() ?? abort(404);
->first();

abort_if(! $response, 404);

return $response;
}
}
2 changes: 1 addition & 1 deletion app/Models/Newsletter.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Newsletter extends Model

protected $guarded = [];

public static function remember(string $email): static
public static function remember(string $email): self
{
return static::create([
'email' => $email
Expand Down
3 changes: 3 additions & 0 deletions app/Models/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
use Illuminate\Database\Eloquent\Model;
use Spatie\Translatable\HasTranslations;

/**
* @property string $title
*/
class Page extends Model
{
use HasFactory, ConvertsToWebp, HasTranslations, IsLocalizable;
Expand Down
6 changes: 5 additions & 1 deletion app/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
use Spatie\Sluggable\SlugOptions;
use Spatie\Translatable\HasTranslations;

/**
* @property string $title
* @property string $description
*/
class Post extends Model
{
use HasFactory, ConvertsToWebp, HasTranslations, HasTranslatableSlug, IsLocalizable;
Expand Down Expand Up @@ -82,7 +86,7 @@ public function isPublished(): bool
public function calculateRead(): int
{
$words = 0;
foreach (optional(json_decode($this->content, true))['blocks'] ?? [] as $block) {
foreach (optional(json_decode($this->getTranslation('content', app()->getLocale()), true))['blocks'] ?? [] as $block) {
try {
$words += str_word_count($block['data']['text']);
} catch (Exception $e) {
Expand Down
3 changes: 3 additions & 0 deletions app/Models/Topic.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use Spatie\Sluggable\SlugOptions;
use Spatie\Translatable\HasTranslations;

/**
* @property string $name
*/
class Topic extends Model
{
use HasFactory, HasSlug, HasTranslations, IsLocalizable;
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"advoor/nova-editor-js": "^2.0",
"artesaos/seotools": "^0.20.0",
"bakerkretzmar/nova-settings-tool": "^1.1",
"based/laravel-fluent": "^0.0.6",
"blade-ui-kit/blade-heroicons": "^1.2",
"davidhsianturi/blade-bootstrap-icons": "^1.0",
"fideloper/proxy": "^4.4",
Expand Down
Loading

0 comments on commit e04844c

Please sign in to comment.