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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Change Log
All notable changes to `sluggable` will be documented in this file.

## 1.1.5 - 2025-09-23
- **Fix:** Added publishable action stub mapping and template to restore `vendor:publish --tag=actions-stubs` support.
- **Tests:** Added coverage to ensure the action stub publishes successfully.

## 1.1.4 - 2025-08-26
- **Change:** Dropped support for Laravel 11; package now targets Laravel 12 and newer.
- **Change:** Bumped minimum PHP version requirement to 8.4.
Expand Down
5 changes: 5 additions & 0 deletions src/SluggableServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ public function boot()
$this->publishes([
__DIR__.'/../config/sluggable.php' => config_path('sluggable.php'),
], 'config');

// Publish the action stub
$this->publishes([
__DIR__.'/../stubs/action.stub' => base_path('stubs/action.stub'),
], 'actions-stubs');
}

/**
Expand Down
15 changes: 15 additions & 0 deletions stubs/action.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace {{ namespace }};

use Lorisleiva\Actions\Concerns\AsAction;

class {{ class }}
{
use AsAction;

public function handle()
{
//
}
}
15 changes: 15 additions & 0 deletions tests/Feature/SluggableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@
$this->assertFileExists(config_path('sluggable.php'));
});

it('can publish the action stub', function () {
$stubPath = base_path('stubs/action.stub');

if (file_exists($stubPath)) {
unlink($stubPath);
}

$this->artisan('vendor:publish', [
'--provider' => 'AesirCloud\Sluggable\SluggableServiceProvider',
'--tag' => 'actions-stubs',
])->assertExitCode(0);

$this->assertFileExists($stubPath);
});

it('merges the configuration file', function () {
$config = config('sluggable.source');
expect($config)->toBe('title');
Expand Down