Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions .env.ci
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ APP_MAINTENANCE_DRIVER=file
PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=4

LOG_CHANNEL=stack
LOG_STACK=single
LOG_CHANNEL=null
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- main

permissions:
contents: write

jobs:
lint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -59,4 +62,4 @@ jobs:
uses: stefanzweifel/git-auto-commit-action@v6
with:
commit_message: "chore: fix code style"
commit_options: '--no-verify'
commit_options: "--no-verify"
13 changes: 8 additions & 5 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use App\Settings\SeoSettings;
use App\Settings\SiteSettings;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Vite;
use Illuminate\Support\ServiceProvider;
use Packages\React\Services\ReactService;
Expand Down Expand Up @@ -37,11 +38,13 @@ public function boot(): void
{
Vite::prefetch(concurrency: 6);

register_shutdown_function(function () {
if (memory_get_usage() > 100 * 1024 * 1024) {
logger()->warning('High memory usage: ' . memory_get_usage());
}
});
if ($this->app->environment('testings')) {
register_shutdown_function(function () {
if (memory_get_usage() > 100 * 1024 * 1024) {
Log::warning('High memory usage: ' . memory_get_usage());
}
});
}

$this->loadObservers();
$this->loadMacros();
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
"psr-4": {
"Tests\\": "tests/",
"Packages\\Tag\\Tests\\": "packages/Tag/tests/",
"Packages\\Category\\Tests\\": "packages/Category/tests/"
"Packages\\Category\\Tests\\": "packages/Category/tests/",
"Packages\\Article\\Tests\\": "packages/Article/tests/"
}
},
"scripts": {
Expand Down
162 changes: 81 additions & 81 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions packages/Article/database/factories/ArticleFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Packages\Article\Database\Factories;

use App\Models\User;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
use Packages\Article\Models\Article;
Expand All @@ -25,14 +26,16 @@ public function definition()

return [
'title' => $title,
'slug' => Str::slug($title) . '-' . $this->faker->unique()->numberBetween(1, 9999),
'slug' => Str::slug($title),
'excerpt' => $this->faker->paragraph(2),
'content' => $this->faker->paragraphs(5, true),
'status' => $this->faker->randomElement(['DRAFT', 'PUBLISHED', 'PENDING']),
'sources' => collect(range(0, rand(0, 5)))->map(function () {
return [
'url' => $this->faker->domainName(),
'date' => $this->faker->dateTimeBetween('-6 months', '+6 months'),
'url' => $this->faker->url(),
'date' => Carbon::instance(
$this->faker->dateTimeBetween('-6 months', '+6 months')
)->toDateTimeString(),
];
})->toArray(),
'published_at' => $this->faker->optional()->dateTimeBetween('-1 year', 'now'),
Expand Down
11 changes: 1 addition & 10 deletions packages/Article/database/seeders/ArticleSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,11 @@

use Illuminate\Database\Seeder;
use Packages\Article\Models\Article;
use Packages\React\Models\Comment;
use Packages\React\Models\Dislike;
use Packages\React\Models\Like;
use Packages\React\Models\Save;

class ArticleSeeder extends Seeder
{
public function run(): void
{
Article::factory(20)->create()->each(function (Article $article) {
Like::factory(10)->forModel($article)->create();
Dislike::factory(10)->forModel($article)->create();
Save::factory(10)->forModel($article)->create();
Comment::factory(20)->forModel($article)->create();
});
Article::factory(20)->create();
}
}
2 changes: 1 addition & 1 deletion packages/Article/routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Route::middleware([HandleInertiaRequests::class])->prefix('makale')->name('article.')->group(function () {
Route::controller(ArticleCrudController::class)->middleware('auth')->name('crud.')->group(function () {
Route::get('/yaz', 'createView')->name('create.view')->can('create', Article::class);
Route::get('/{article:slug}/duzenle', 'editView')->name('edit.view')->can('view,article');
Route::get('/{article:slug}/duzenle', 'editView')->name('edit.view')->can('update,article');
});

Route::controller(ArticleController::class)->group(function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/Article/src/Data/ArticleData.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ArticleData extends Data
* @param array{image: string, responsive: string|array<int, string>, srcset: string, thumb: string|null} $image
* @param array<CategoryData> $categories
* @param array<TagData> $tags
* @param array{url: string, date: string} $sources
* @param array<int, array{url: string, date: string}> $sources
*/
public function __construct(
public ?int $id,
Expand Down
20 changes: 10 additions & 10 deletions packages/Article/src/Http/Requests/CreateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ public function rules(): array

if (! $isDraft) {
$rules = array_merge($rules, [
'excerpt' => ['required', 'string', 'min:100'],
'content' => ['required', 'string', 'min:500'],
'categories' => ['required', 'array', 'min:1', 'max:3'],
'categories.*' => ['string'],
'tags' => ['required', 'array', 'min:1', 'max:3'],
'tags.*' => ['string'],
'image' => ['required', 'file', 'image'],
'sources' => ['required', 'array', 'min:1'],
'sources.url' => ['required', 'string', 'url'],
'sources.date' => ['required', 'date'],
'excerpt' => ['required', 'string', 'min:100'],
'content' => ['required', 'string', 'min:500'],
'categories' => ['required', 'array', 'min:1', 'max:3'],
'categories.*' => ['string'],
'tags' => ['required', 'array', 'min:1', 'max:3'],
'tags.*' => ['string'],
'image' => ['required', 'file', 'image'],
'sources' => ['required', 'array', 'min:1'],
'sources.*.url' => ['required', 'string', 'url'],
'sources.*.date' => ['required', 'date'],
]);
}

Expand Down
Loading
Loading