diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 3b0259c..c4c2373 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,11 +1,11 @@ blank_issues_enabled: false contact_links: - name: Ask a question - url: https://github.com/:github_name/:package_name/discussions/new?category=q-a + url: https://github.com/ibec-box/admin-kit-vacancy/discussions/new?category=q-a about: Ask the community for help - name: Request a feature - url: https://github.com/:github_name/:package_name/discussions/new?category=ideas + url: https://github.com/ibec-box/admin-kit-vacancy/discussions/new?category=ideas about: Share ideas for new features - name: Report a security issue - url: https://github.com/:github_name/:package_name/security/policy + url: https://github.com/ibec-box/admin-kit-vacancy/security/policy about: Learn how to notify us for sensitive bugs diff --git a/CHANGELOG.md b/CHANGELOG.md index 87b3242..6ffeb28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ # Changelog -All notable changes to `:package_name` will be documented in this file. +All notable changes to `admin-kit-vacancy` will be documented in this file. diff --git a/LICENSE.md b/LICENSE.md index f334c37..7ce511e 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) :github_name +Copyright (c) ibec-box Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 293a03c..c95a298 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,10 @@ -# :package_description - -[![Latest Version on Packagist](https://img.shields.io/packagist/v/:github_name/:package_slug.svg?style=flat-square)](https://packagist.org/packages/:packagist_name/:package_slug) -[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/:github_name/:package_slug/run-tests.yml?branch=2.x&label=tests&style=flat-square)](https://github.com/:github_name/:package_slug/actions?query=workflow%3Arun-tests+branch%3A2.x) -[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/:github_name/:package_slug/fix-php-code-style-issues.yml?branch=2.x&label=code%20style&style=flat-square)](https://github.com/:github_name/:package_slug/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3A2.x) -[![Total Downloads](https://img.shields.io/packagist/dt/:github_name/:package_slug.svg?style=flat-square)](https://packagist.org/packages/:packagist_name/:package_slug) - ---- -This repo can be used to scaffold a Laravel package. Follow these steps to get started: - -1. Press the "Use this template" button at the top of this repo to create a new repo with the contents of this skeleton. -2. Run "php ./configure.php" to run a script that will replace all placeholders throughout all the files. -3. Have fun creating your package. -4. If you need help creating a package, consider picking up our Laravel Package Training video course. ---- - +# Vacancy package for Admin Kit + +[![Latest Version on Packagist](https://img.shields.io/packagist/v/ibec-box/admin-kit-vacancy.svg?style=flat-square)](https://packagist.org/packages/ibecsystems/admin-kit-vacancy) +[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/ibec-box/admin-kit-vacancy/run-tests.yml?branch=2.x&label=tests&style=flat-square)](https://github.com/ibec-box/admin-kit-vacancy/actions?query=workflow%3Arun-tests+branch%3A2.x) +[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/ibec-box/admin-kit-vacancy/fix-php-code-style-issues.yml?branch=2.x&label=code%20style&style=flat-square)](https://github.com/ibec-box/admin-kit-vacancy/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3A2.x) +[![Total Downloads](https://img.shields.io/packagist/dt/ibec-box/admin-kit-vacancy.svg?style=flat-square)](https://packagist.org/packages/ibecsystems/admin-kit-vacancy) + This is where your description should go. Limit it to a paragraph or two. Consider adding a small example. ## Installation @@ -21,20 +12,20 @@ This is where your description should go. Limit it to a paragraph or two. Consid You can install the package via composer: ```bash -composer require :packagist_name/:package_slug +composer require ibecsystems/admin-kit-vacancy ``` You can publish and run the migrations with: ```bash -php artisan vendor:publish --tag=":package_slug-migrations" +php artisan vendor:publish --tag="admin-kit-vacancy-migrations" php artisan migrate ``` You can publish the config file with: ```bash -php artisan vendor:publish --tag=":package_slug-config" +php artisan vendor:publish --tag="admin-kit-vacancy-config" ``` This is the contents of the published config file: @@ -47,7 +38,7 @@ return [ Optionally, you can publish the views using ```bash -php artisan vendor:publish --tag=":package_slug-views" +php artisan vendor:publish --tag="admin-kit-vacancy-views" ``` ## Usage @@ -64,7 +55,7 @@ class AdminPanelProvider extends PanelProvider ... ->plugins([ ... - \VendorName\Skeleton\FilamentPlugin::make(), + \AdminKit\Vacancy\FilamentPlugin::make(), ]); } } @@ -90,7 +81,7 @@ Please review [our security policy](../../security/policy) on how to report secu ## Credits -- [:author_name](https://github.com/:author_username) +- [daurensky](https://github.com/IBEC-BOX) - [All Contributors](../../contributors) ## License diff --git a/composer.json b/composer.json index 9c75524..ab03feb 100644 --- a/composer.json +++ b/composer.json @@ -1,17 +1,17 @@ { - "name": ":packagist_name/:package_slug", - "description": ":package_description", + "name": "ibecsystems/admin-kit-vacancy", + "description": "Vacancy package for Admin Kit", "keywords": [ - ":github_name", + "ibec-box", "laravel", - ":package_slug" + "admin-kit-vacancy" ], - "homepage": "https://github.com/:github_name/:package_slug", + "homepage": "https://github.com/ibec-box/admin-kit-vacancy", "license": "MIT", "authors": [ { - "name": ":author_name", - "email": "author@domain.com", + "name": "daurensky", + "email": "dkambarov17@gmail.com", "role": "Developer" } ], @@ -40,13 +40,13 @@ }, "autoload": { "psr-4": { - "VendorName\\Skeleton\\": "src/", - "VendorName\\Skeleton\\Database\\Factories\\": "database/factories/" + "AdminKit\\Vacancy\\": "src/", + "AdminKit\\Vacancy\\Database\\Factories\\": "database/factories/" } }, "autoload-dev": { "psr-4": { - "VendorName\\Skeleton\\Tests\\": "tests/" + "AdminKit\\Vacancy\\Tests\\": "tests/" } }, "scripts": { @@ -66,10 +66,10 @@ "extra": { "laravel": { "providers": [ - "VendorName\\Skeleton\\SkeletonServiceProvider" + "AdminKit\\Vacancy\\VacancyServiceProvider" ], "aliases": { - "Skeleton": "VendorName\\Skeleton\\Facades\\Skeleton" + "Vacancy": "AdminKit\\Vacancy\\Facades\\Vacancy" } } }, diff --git a/config/admin-kit-vacancy.php b/config/admin-kit-vacancy.php new file mode 100644 index 0000000..f423db6 --- /dev/null +++ b/config/admin-kit-vacancy.php @@ -0,0 +1,6 @@ + $version) { - if (in_array($name, $names, true)) { - unset($data['require-dev'][$name]); - } - } - - file_put_contents(__DIR__.'/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)); -} - -function remove_composer_script($scriptName) -{ - $data = json_decode(file_get_contents(__DIR__.'/composer.json'), true); - - foreach ($data['scripts'] as $name => $script) { - if ($scriptName === $name) { - unset($data['scripts'][$name]); - break; - } - } - - file_put_contents(__DIR__.'/composer.json', json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)); -} - -function remove_readme_paragraphs(string $file): void -{ - $contents = file_get_contents($file); - - file_put_contents( - $file, - preg_replace('/.*/s', '', $contents) ?: $contents - ); -} - -function safeUnlink(string $filename) -{ - if (file_exists($filename) && is_file($filename)) { - unlink($filename); - } -} - -function determineSeparator(string $path): string -{ - return str_replace('/', DIRECTORY_SEPARATOR, $path); -} - -function replaceForWindows(): array -{ - return preg_split('/\\r\\n|\\r|\\n/', run('dir /S /B * | findstr /v /i .git\ | findstr /v /i vendor | findstr /v /i '.basename(__FILE__).' | findstr /r /i /M /F:/ ":author :vendor :package VendorName skeleton migration_table_name github_name packagist_name author@domain.com"')); -} - -function replaceForAllOtherOSes(): array -{ - return explode(PHP_EOL, run('grep -E -r -l -i ":author|:vendor|:package|VendorName|skeleton|migration_table_name|github_name|packagist_name|author@domain.com" --exclude-dir=vendor ./* ./.github/* | grep -v '.basename(__FILE__))); -} - -$gitName = run('git config user.name'); -$authorName = ask('Author name', $gitName); - -$gitEmail = run('git config user.email'); -$authorEmail = ask('Author email', $gitEmail); - -$usernameGuess = explode(':', run('git config remote.origin.url'))[1]; -$usernameGuess = dirname($usernameGuess); -$usernameGuess = basename($usernameGuess); -$authorUsername = ask('Author username', $usernameGuess); - -$githubName = 'ibec-box'; -$packagistName = 'ibecsystems'; -$vendorNamespace = 'AdminKit'; - -$currentDirectory = getcwd(); -$folderName = basename($currentDirectory); - -$packageName = ask('Package name', $folderName); -$packageSlug = slugify($packageName); -$packageSlugWithoutPrefix = remove_prefix('admin-kit-', $packageSlug); - -$className = ask('Class name', title_case($packageSlugWithoutPrefix)); -$singleName = ask('Single name', $className); -$description = ask('Package description', "$className package for Admin Kit"); -$variableName = lcfirst($className); - -$usePhpStan = confirm('Enable PhpStan?', true); -$useLaravelPint = confirm('Enable Laravel Pint?', true); -$useDependabot = confirm('Enable Dependabot?', true); -$useUpdateChangelogWorkflow = confirm('Use automatic changelog updater workflow?', true); - -writeln('------'); -writeln("Author : {$authorName} ({$authorUsername}, {$authorEmail})"); -writeln("Vendor : {$githubName} ({$packagistName})"); -writeln("Package : {$packageSlug} <{$description}>"); -writeln("Namespace : {$vendorNamespace}\\{$className}"); -writeln("Class name : {$className}"); -writeln('---'); -writeln('Packages & Utilities'); -writeln('Use Laravel/Pint : '.($useLaravelPint ? 'yes' : 'no')); -writeln('Use Larastan/PhpStan : '.($usePhpStan ? 'yes' : 'no')); -writeln('Use Dependabot : '.($useDependabot ? 'yes' : 'no')); -writeln('Use Auto-Changelog : '.($useUpdateChangelogWorkflow ? 'yes' : 'no')); -writeln('------'); - -writeln('This script will replace the above values in all relevant files in the project directory.'); - -if (! confirm('Modify files?', true)) { - exit(1); -} - -$files = (str_starts_with(strtoupper(PHP_OS), 'WIN') ? replaceForWindows() : replaceForAllOtherOSes()); - -foreach ($files as $file) { - replace_in_file($file, [ - ':author_name' => $authorName, - ':author_username' => $authorUsername, - 'author@domain.com' => $authorEmail, - ':github_name' => $githubName, - ':packagist_name' => $packagistName, - 'VendorName' => $vendorNamespace, - ':package_name' => $packageName, - ':package_slug' => $packageSlug, - 'Skeleton' => $className, - 'skeleton_without_prefix' => $packageSlugWithoutPrefix, - 'skeleton' => $packageSlug, - 'SingleName' => $singleName, - 'migration_table_name' => title_snake($packageSlug), - 'variable' => $variableName, - ':package_description' => $description, - ]); - - match (true) { - str_contains($file, determineSeparator('src/UI/API/Controllers/SingleNameController.php')) => rename($file, determineSeparator('./src/UI/API/Controllers/'.$singleName.'Controller.php')), - str_contains($file, determineSeparator('src/UI/Filament/Resources/SingleNameResource.php')) => rename($file, determineSeparator('./src/UI/Filament/Resources/'.$singleName.'Resource.php')), - str_contains($file, determineSeparator('src/UI/Filament/Resources/SingleNameResource/Pages/CreateSingleName.php')) => rename($file, determineSeparator('./src/UI/Filament/Resources/SingleNameResource/Pages/Create'.$singleName.'.php')), - str_contains($file, determineSeparator('src/UI/Filament/Resources/SingleNameResource/Pages/EditSingleName.php')) => rename($file, determineSeparator('./src/UI/Filament/Resources/SingleNameResource/Pages/Edit'.$singleName.'.php')), - str_contains($file, determineSeparator('src/UI/Filament/Resources/SingleNameResource/Pages/ListSingleName.php')) => rename($file, determineSeparator('./src/UI/Filament/Resources/SingleNameResource/Pages/List'.$singleName.'.php')), - str_contains($file, determineSeparator('src/Models/SingleName.php')) => rename($file, determineSeparator('./src/Models/'.$singleName.'.php')), - str_contains($file, determineSeparator('src/Skeleton.php')) => rename($file, determineSeparator('./src/'.$className.'.php')), - str_contains($file, determineSeparator('src/SkeletonServiceProvider.php')) => rename($file, determineSeparator('./src/'.$className.'ServiceProvider.php')), - str_contains($file, determineSeparator('src/Facades/Skeleton.php')) => rename($file, determineSeparator('./src/Facades/'.$className.'.php')), - str_contains($file, determineSeparator('src/Commands/SkeletonCommand.php')) => rename($file, determineSeparator('./src/Commands/'.$className.'Command.php')), - str_contains($file, determineSeparator('database/factories/SingleNameFactory.php')) => rename($file, determineSeparator('./database/factories/'.$singleName.'Factory.php')), - str_contains($file, determineSeparator('database/migrations/create_skeleton_table.php.stub')) => rename($file, determineSeparator('./database/migrations/create_'.title_snake($packageSlug).'_table.php.stub')), - str_contains($file, determineSeparator('resources/lang/en/skeleton_without_prefix.php')) => rename($file, determineSeparator('./resources/lang/en/'.$packageSlugWithoutPrefix.'.php')), - str_contains($file, determineSeparator('resources/lang/ru/skeleton_without_prefix.php')) => rename($file, determineSeparator('./resources/lang/ru/'.$packageSlugWithoutPrefix.'.php')), - str_contains($file, determineSeparator('config/skeleton.php')) => rename($file, determineSeparator('./config/'.$packageSlug.'.php')), - str_contains($file, 'README.md') => remove_readme_paragraphs($file), - default => [], - }; -} - -rename('src/UI/Filament/Resources/SingleNameResource', determineSeparator('./src/UI/Filament/Resources/'.$singleName.'Resource')); - -if (! $useLaravelPint) { - safeUnlink(__DIR__.'/.github/workflows/fix-php-code-style-issues.yml'); - safeUnlink(__DIR__.'/pint.json'); -} - -if (! $usePhpStan) { - safeUnlink(__DIR__.'/phpstan.neon.dist'); - safeUnlink(__DIR__.'/phpstan-baseline.neon'); - safeUnlink(__DIR__.'/.github/workflows/phpstan.yml'); - - remove_composer_deps([ - 'phpstan/extension-installer', - 'phpstan/phpstan-deprecation-rules', - 'phpstan/phpstan-phpunit', - 'nunomaduro/larastan', - ]); - - remove_composer_script('phpstan'); -} - -if (! $useDependabot) { - safeUnlink(__DIR__.'/.github/dependabot.yml'); - safeUnlink(__DIR__.'/.github/workflows/dependabot-auto-merge.yml'); -} - -if (! $useUpdateChangelogWorkflow) { - safeUnlink(__DIR__.'/.github/workflows/update-changelog.yml'); -} - -confirm('Execute `composer install` and run tests?') && run('composer install && composer test'); - -confirm('Let this script delete itself?', true) && unlink(__FILE__); diff --git a/database/factories/SingleNameFactory.php b/database/factories/SingleNameFactory.php deleted file mode 100644 index b7642e5..0000000 --- a/database/factories/SingleNameFactory.php +++ /dev/null @@ -1,18 +0,0 @@ -id(); // add fields @@ -20,6 +20,6 @@ return new class extends Migration public function down() { - Schema::dropIfExists('migration_table_name'); + Schema::dropIfExists('admin_kit_vacancy'); } }; diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0ebf661..7e9be16 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -16,7 +16,7 @@ backupStaticProperties="false" > - + tests diff --git a/resources/lang/en/skeleton_without_prefix.php b/resources/lang/en/vacancy.php similarity index 71% rename from resources/lang/en/skeleton_without_prefix.php rename to resources/lang/en/vacancy.php index 7b99a07..641894a 100644 --- a/resources/lang/en/skeleton_without_prefix.php +++ b/resources/lang/en/vacancy.php @@ -2,8 +2,8 @@ return [ 'resource' => [ - 'label' => 'SingleName', - 'plural_label' => 'Skeleton', + 'label' => 'Vacancy', + 'plural_label' => 'Vacancy', 'id' => 'ID', 'title' => 'Title', diff --git a/resources/lang/ru/skeleton_without_prefix.php b/resources/lang/ru/vacancy.php similarity index 71% rename from resources/lang/ru/skeleton_without_prefix.php rename to resources/lang/ru/vacancy.php index b9df386..44b0040 100644 --- a/resources/lang/ru/skeleton_without_prefix.php +++ b/resources/lang/ru/vacancy.php @@ -2,8 +2,8 @@ return [ 'resource' => [ - 'label' => 'SingleName', - 'plural_label' => 'Skeleton', + 'label' => 'Vacancy', + 'plural_label' => 'Vacancy', 'id' => 'ID', 'title' => 'Title', diff --git a/src/Commands/SkeletonCommand.php b/src/Commands/VacancyCommand.php similarity index 62% rename from src/Commands/SkeletonCommand.php rename to src/Commands/VacancyCommand.php index 3e5f628..bbf62a1 100644 --- a/src/Commands/SkeletonCommand.php +++ b/src/Commands/VacancyCommand.php @@ -1,12 +1,12 @@ resources([ - SingleNameResource::class, + VacancyResource::class, ]); } diff --git a/src/Models/SingleName.php b/src/Models/Vacancy.php similarity index 56% rename from src/Models/SingleName.php rename to src/Models/Vacancy.php index 500397a..d0857ec 100644 --- a/src/Models/SingleName.php +++ b/src/Models/Vacancy.php @@ -1,18 +1,18 @@ schema([ TranslatableTabs::make(fn ($locale) => Forms\Components\Tabs\Tab::make($locale)->schema([ Forms\Components\TextInput::make('title') - ->label(__('skeleton::skeleton_without_prefix.resource.title')) + ->label(__('admin-kit-vacancy::vacancy.resource.title')) ->required($locale === app()->getLocale()), ])), ]) @@ -33,12 +33,12 @@ public static function table(Tables\Table $table): Tables\Table return $table ->columns([ Tables\Columns\TextColumn::make('id') - ->label(__('skeleton::skeleton_without_prefix.resource.id')) + ->label(__('admin-kit-vacancy::vacancy.resource.id')) ->sortable(), Tables\Columns\TextColumn::make('title') - ->label(__('skeleton::skeleton_without_prefix.resource.title')), + ->label(__('admin-kit-vacancy::vacancy.resource.title')), Tables\Columns\TextColumn::make('created_at') - ->label(__('skeleton::skeleton_without_prefix.resource.created_at')), + ->label(__('admin-kit-vacancy::vacancy.resource.created_at')), ]) ->defaultSort('id', 'desc') ->filters([ @@ -64,24 +64,24 @@ public static function getRelations(): array public static function getPages(): array { return [ - 'index' => Pages\ListSingleName::route('/'), - 'create' => Pages\CreateSingleName::route('/create'), - 'edit' => Pages\EditSingleName::route('/{record}/edit'), + 'index' => Pages\ListVacancy::route('/'), + 'create' => Pages\CreateVacancy::route('/create'), + 'edit' => Pages\EditVacancy::route('/{record}/edit'), ]; } public static function getLabel(): ?string { - return __('skeleton::skeleton_without_prefix.resource.label'); + return __('admin-kit-vacancy::vacancy.resource.label'); } public static function getPluralLabel(): ?string { - return __('skeleton::skeleton_without_prefix.resource.plural_label'); + return __('admin-kit-vacancy::vacancy.resource.plural_label'); } public static function getNavigationGroup(): ?string { - return __('skeleton::skeleton_without_prefix.resource.plural_label'); + return __('admin-kit-vacancy::vacancy.resource.plural_label'); } } diff --git a/src/UI/Filament/Resources/VacancyResource/Pages/CreateVacancy.php b/src/UI/Filament/Resources/VacancyResource/Pages/CreateVacancy.php new file mode 100644 index 0000000..63a0a76 --- /dev/null +++ b/src/UI/Filament/Resources/VacancyResource/Pages/CreateVacancy.php @@ -0,0 +1,23 @@ +name('skeleton') + ->name('admin-kit-vacancy') ->hasConfigFile() ->hasViews() ->hasTranslations() - ->hasMigration('create_migration_table_name_table') - ->hasCommand(SkeletonCommand::class); + ->hasMigration('create_admin_kit_vacancy_table') + ->hasCommand(VacancyCommand::class); } public function registeringPackage() diff --git a/tests/Pest.php b/tests/Pest.php index 7fe1500..5b2df1f 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -1,5 +1,5 @@ in(__DIR__); diff --git a/tests/TestCase.php b/tests/TestCase.php index 00a698c..a6c58db 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,11 +1,11 @@ 'VendorName\\Skeleton\\Database\\Factories\\'.class_basename($modelName).'Factory' + fn (string $modelName) => 'AdminKit\\Vacancy\\Database\\Factories\\'.class_basename($modelName).'Factory' ); } protected function getPackageProviders($app) { return [ - SkeletonServiceProvider::class, + VacancyServiceProvider::class, LivewireServiceProvider::class, ]; } @@ -31,7 +31,7 @@ public function getEnvironmentSetUp($app) config()->set('database.default', 'testing'); /* - $migration = include __DIR__.'/../database/migrations/create_skeleton_table.php.stub'; + $migration = include __DIR__.'/../database/migrations/create_admin-kit-vacancy_table.php.stub'; $migration->up(); */ }