Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
5 changes: 4 additions & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
# Checkout the actual branch, not a specific commit
ref: ${{ github.head_ref || github.ref_name }}
# Fetch the full history to avoid shallow clone issues
fetch-depth: 0

- name: Run Laravel Pint
uses: aglipanci/laravel-pint-action@latest
Expand Down
19 changes: 0 additions & 19 deletions .github/workflows/release-please.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/test-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
matrix:
os: [ ubuntu-latest ]
php: [ 8.2, 8.3, 8.4 ]
dependency-version: [ prefer-lowest, prefer-stable ]
dependency-version: [ prefer-stable ]

name: ${{ matrix.os }} / PHP ${{ matrix.php }} / ${{ matrix.dependency-version }}

Expand All @@ -41,7 +41,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}

- name: Validate composer.json and composer.lock
run: composer validate --strict
Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
"datalinx/php-utils": "^2.5",
"eclipsephp/common": "dev-main",
"filament/filament": "^3.3",
"filament/spatie-laravel-translatable-plugin": "^3.3",
"spatie/image": "^3.8",
"spatie/laravel-package-tools": "^1.19"
},
"require-dev": {
Expand Down
53 changes: 53 additions & 0 deletions database/factories/BannerFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace Eclipse\Cms\Factories;

use Eclipse\Cms\Models\Banner;
use Illuminate\Database\Eloquent\Factories\Factory;

class BannerFactory extends Factory
{
protected $model = Banner::class;

public function definition(): array
{
$names = [
'en' => ['Summer Sale', 'Winter Sale', 'Special Offer', 'New Arrivals', 'Featured Deal'],
'sl' => ['Poletna Razprodaja', 'Zimska Razprodaja', 'Posebna Ponudba', 'Nove Stvari', 'Izpostavljena Ponudba'],
];

$nameIndex = $this->faker->numberBetween(0, count($names['en']) - 1);

return [
'name' => [
'en' => $names['en'][$nameIndex],
'sl' => $names['sl'][$nameIndex],
],
'link' => 'https://example.com/'.$this->faker->slug(2),
'is_active' => $this->faker->boolean(80),
'new_tab' => $this->faker->boolean(30),
'sort' => $this->faker->numberBetween(1, 10),
];
}

public function active(): static
{
return $this->state(fn (array $attributes): array => [
'is_active' => true,
]);
}

public function inactive(): static
{
return $this->state(fn (array $attributes): array => [
'is_active' => false,
]);
}

public function newTab(): static
{
return $this->state(fn (array $attributes): array => [
'new_tab' => true,
]);
}
}
83 changes: 83 additions & 0 deletions database/factories/BannerImageFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php

namespace Eclipse\Cms\Factories;

use Eclipse\Cms\Models\Banner\Image;
use Illuminate\Database\Eloquent\Factories\Factory;

class BannerImageFactory extends Factory
{
protected $model = Image::class;

public function definition(): array
{
$sampleImages = [
'banners/summer-sale-desktop.jpg',
'banners/winter-collection-mobile.jpg',
'banners/spring-deals-tablet.jpg',
'banners/black-friday-hero.jpg',
'banners/new-arrivals-sidebar.jpg',
'banners/limited-offer-footer.jpg',
'banners/featured-product-square.jpg',
'banners/special-promo-wide.jpg',
'banners/holiday-sale-banner.jpg',
'banners/end-season-deals.jpg',
];

return [
'file' => $this->faker->randomElement($sampleImages),
'image_width' => $this->faker->randomElement([400, 800, 1200, 1920]),
'image_height' => $this->faker->randomElement([200, 400, 600, 800]),
'is_hidpi' => $this->faker->boolean(30),
];
}

public function desktop(): static
{
return $this->state(fn (array $attributes): array => [
'file' => 'banners/desktop-'.$this->faker->slug().'.jpg',
'image_width' => 1920,
'image_height' => 600,
'is_hidpi' => false,
]);
}

public function mobile(): static
{
return $this->state(fn (array $attributes): array => [
'file' => 'banners/mobile-'.$this->faker->slug().'.jpg',
'image_width' => 800,
'image_height' => 400,
'is_hidpi' => true,
]);
}

public function tablet(): static
{
return $this->state(fn (array $attributes): array => [
'file' => 'banners/tablet-'.$this->faker->slug().'.jpg',
'image_width' => 1024,
'image_height' => 500,
'is_hidpi' => false,
]);
}

public function square(): static
{
return $this->state(fn (array $attributes): array => [
'file' => 'banners/square-'.$this->faker->slug().'.jpg',
'image_width' => 400,
'image_height' => 400,
'is_hidpi' => false,
]);
}

public function hidpi(): static
{
return $this->state(fn (array $attributes): array => [
'is_hidpi' => true,
'image_width' => $attributes['image_width'] * 2,
'image_height' => $attributes['image_height'] * 2,
]);
}
}
60 changes: 60 additions & 0 deletions database/factories/BannerImageTypeFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

namespace Eclipse\Cms\Factories;

use Eclipse\Cms\Models\Banner\ImageType;
use Illuminate\Database\Eloquent\Factories\Factory;

class BannerImageTypeFactory extends Factory
{
protected $model = ImageType::class;

public function definition(): array
{
return [
'name' => [
'en' => 'Desktop',
'sl' => 'Namizje',
],
'code' => 'desktop',
'image_width' => 1200,
'image_height' => 400,
'is_hidpi' => false,
];
}

public function desktop(): static
{
return $this->state(fn (array $attributes) => [
'name' => [
'en' => 'Desktop',
'sl' => 'Namizje',
],
'code' => 'desktop',
'image_width' => 1200,
'image_height' => 400,
'is_hidpi' => false,
]);
}

public function mobile(): static
{
return $this->state(fn (array $attributes) => [
'name' => [
'en' => 'Mobile',
'sl' => 'Mobilni',
],
'code' => 'mobile',
'image_width' => 800,
'image_height' => 400,
'is_hidpi' => true,
]);
}

public function hidpi(): static
{
return $this->state(fn (array $attributes) => [
'is_hidpi' => true,
]);
}
}
22 changes: 22 additions & 0 deletions database/factories/BannerPositionFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Eclipse\Cms\Factories;

use Eclipse\Cms\Models\Banner\Position;
use Illuminate\Database\Eloquent\Factories\Factory;

class BannerPositionFactory extends Factory
{
protected $model = Position::class;

public function definition(): array
{
return [
'name' => [
'en' => 'Website Banners',
'sl' => 'Spletni Bannerji',
],
'code' => 'website',
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up(): void
{
Schema::table('cms_banner_images', function (Blueprint $table) {
$table->json('file')->change();
});
}

public function down(): void
{
Schema::table('cms_banner_images', function (Blueprint $table) {
$table->string('file')->change();
});
}
};
Loading