Skip to content

Commit

Permalink
⚡️ First refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
rxcod9 committed Apr 3, 2022
1 parent 111ab8d commit 4a41278
Show file tree
Hide file tree
Showing 18 changed files with 133 additions and 133 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: Ask a Question
url: https://github.com/rxcod9/joy-voyager-replace-keyword/discussions/new?category=q-a
url: https://github.com/rxcod9/joy-voyager-widgets/discussions/new?category=q-a
about: Ask the community for help
- name: Feature Request
url: https://github.com/rxcod9/joy-voyager-replace-keyword/discussions/new?category=ideas
url: https://github.com/rxcod9/joy-voyager-widgets/discussions/new?category=ideas
about: Share ideas for new features
- name: Bug Report
url: https://github.com/rxcod9/joy-voyager-replace-keyword/issues/new
url: https://github.com/rxcod9/joy-voyager-widgets/issues/new
about: Report a reproducable bug
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Joy VoyagerReplaceKeyword
# Joy VoyagerWidgets

This [Laravel](https://laravel.com/)/[Voyager](https://voyager.devdojo.com/) module adds VoyagerReplaceKeyword support to Voyager.
This [Laravel](https://laravel.com/)/[Voyager](https://voyager.devdojo.com/) module adds VoyagerWidgets support to Voyager.

By 🐼 [Ramakant Gangwar](https://github.com/rxcod9).

[![Screenshot](https://raw.githubusercontent.com/rxcod9/joy-voyager-replace-keyword/main/cover.jpg)](https://joy-voyager.herokuapp.com/)
[![Screenshot](https://raw.githubusercontent.com/rxcod9/joy-voyager-widgets/main/cover.jpg)](https://joy-voyager.herokuapp.com/)

[![Latest Version](https://img.shields.io/github/v/release/rxcod9/joy-voyager-replace-keyword?style=flat-square)](https://github.com/rxcod9/joy-voyager-replace-keyword/releases)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/rxcod9/joy-voyager-replace-keyword/run-tests?label=tests)
[![Total Downloads](https://img.shields.io/packagist/dt/joy/voyager-replace-keyword.svg?style=flat-square)](https://packagist.org/packages/joy/voyager-replace-keyword)
[![Latest Version](https://img.shields.io/github/v/release/rxcod9/joy-voyager-widgets?style=flat-square)](https://github.com/rxcod9/joy-voyager-widgets/releases)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/rxcod9/joy-voyager-widgets/run-tests?label=tests)
[![Total Downloads](https://img.shields.io/packagist/dt/joy/voyager-widgets.svg?style=flat-square)](https://packagist.org/packages/joy/voyager-widgets)

---

Expand All @@ -24,10 +24,10 @@ By 🐼 [Ramakant Gangwar](https://github.com/rxcod9).

```bash
# 1. Require this Package in your fresh Laravel/Voyager project
composer require joy/voyager-replace-keyword
composer require joy/voyager-widgets

# 2. Publish
php artisan vendor:publish --provider="Joy\VoyagerReplaceKeyword\VoyagerReplaceKeywordServiceProvider" --force
php artisan vendor:publish --provider="Joy\VoyagerWidgets\VoyagerWidgetsServiceProvider" --force
```

---
Expand All @@ -39,7 +39,7 @@ You can try laravel demo here [https://joy-voyager.herokuapp.com/admin/users](ht

## Documentation

Find yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improving the joy voyager-replace-keyword? Feel free to [create an issue on GitHub](https://github.com/rxcod9/joy-voyager-replace-keyword/issues), we'll try to address it as soon as possible.
Find yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improving the joy voyager-widgets? Feel free to [create an issue on GitHub](https://github.com/rxcod9/joy-voyager-widgets/issues), we'll try to address it as soon as possible.

If you've found a bug regarding security please mail [gangwar.ramakant@gmail.com](mailto:gangwar.ramakant@gmail.com) instead of using the issue tracker.

Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "joy/voyager-replace-keyword",
"description": "This Laravel/Voyager module adds VoyagerReplaceKeyword support to Voyager.",
"name": "joy/voyager-widgets",
"description": "This Laravel/Voyager module adds VoyagerWidgets support to Voyager.",
"keywords": [
"joy",
"replace-keyword",
"voyager-replace-keyword",
"joy-voyager-replace-keyword",
"widgets",
"voyager-widgets",
"joy-voyager-widgets",
"cms",
"voyager",
"laravel"
],
"homepage": "https://github.com/rxcod9/joy-voyager-replace-keyword",
"homepage": "https://github.com/rxcod9/joy-voyager-widgets",
"license": "MIT",
"authors": [{
"name": "Ramakant Gangwar",
Expand All @@ -35,7 +35,7 @@
},
"autoload": {
"psr-4": {
"Joy\\VoyagerReplaceKeyword\\": "src"
"Joy\\VoyagerWidgets\\": "src"
},
"files": [
"src/helper.php"
Expand All @@ -47,13 +47,13 @@
},
"autoload-dev": {
"psr-4": {
"Joy\\VoyagerReplaceKeyword\\Tests\\": "tests"
"Joy\\VoyagerWidgets\\Tests\\": "tests"
}
},
"extra": {
"laravel": {
"providers": [
"Joy\\VoyagerReplaceKeyword\\VoyagerReplaceKeywordServiceProvider"
"Joy\\VoyagerWidgets\\VoyagerWidgetsServiceProvider"
]
}
},
Expand Down
50 changes: 0 additions & 50 deletions config/voyager-replace-keyword.php

This file was deleted.

50 changes: 50 additions & 0 deletions config/voyager-widgets.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

return [

/*
* If enabled for voyager-widgets package.
*/
'enabled' => env('VOYAGER_WIDGETS_ENABLED', true),

/*
| Here you can specify for which data type slugs widgets is enabled
|
| Supported: "*", or data type slugs "users", "roles"
|
*/

'allowed_slugs' => array_filter(explode(',', env('VOYAGER_WIDGETS_ALLOWED_SLUGS', '*'))),

/*
| Here you can specify for which data type slugs widgets is not allowed
|
| Supported: "*", or data type slugs "users", "roles"
|
*/

'not_allowed_slugs' => array_filter(explode(',', env('VOYAGER_WIDGETS_NOT_ALLOWED_SLUGS', ''))),

/*
* The config_key for voyager-widgets package.
*/
'config_key' => env('VOYAGER_WIDGETS_CONFIG_KEY', 'joy-voyager-widgets'),

/*
* The route_prefix for voyager-widgets package.
*/
'route_prefix' => env('VOYAGER_WIDGETS_ROUTE_PREFIX', 'joy-voyager-widgets'),

/*
|--------------------------------------------------------------------------
| Controllers config
|--------------------------------------------------------------------------
|
| Here you can specify voyager controller settings
|
*/

'controllers' => [
'namespace' => 'Joy\\VoyagerWidgets\\Http\\Controllers',
],
];
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</include>
</coverage>
<testsuites>
<testsuite name="Joy VoyagerReplaceKeyword Test Suite">
<testsuite name="Joy VoyagerWidgets Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
Expand Down
4 changes: 2 additions & 2 deletions resources/lang/en/generic.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

return [
'successfully_replace_keyworded' => 'Successfully ReplaceKeyworded',
'replace_keyword' => 'ReplaceKeyword',
'successfully_widgetsed' => 'Successfully Widgetsed',
'widgets' => 'Widgets',
];
6 changes: 3 additions & 3 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
|--------------------------------------------------------------------------
|
| This file is where you may override any of the routes that are included
| with VoyagerReplaceKeyword.
| with VoyagerWidgets.
|
*/

Route::group(['as' => 'joy-voyager-replace-keyword.'], function () {
Route::group(['as' => 'joy-voyager-widgets.'], function () {
// event(new Routing()); @deprecated

$namespacePrefix = '\\' . config('joy-voyager-replace-keyword.controllers.namespace') . '\\';
$namespacePrefix = '\\' . config('joy-voyager-widgets.controllers.namespace') . '\\';

// event(new RoutingAfter()); @deprecated
});
8 changes: 4 additions & 4 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
|
*/

Route::group(['prefix' => config('joy-voyager-replace-keyword.admin_prefix', 'admin')], function () {
Route::group(['prefix' => config('joy-voyager-widgets.admin_prefix', 'admin')], function () {
Route::group(['as' => 'voyager.'], function () {
// event(new Routing()); @deprecated

$namespacePrefix = '\\'.config('joy-voyager-replace-keyword.controllers.namespace').'\\';
$namespacePrefix = '\\'.config('joy-voyager-widgets.controllers.namespace').'\\';

Route::group(['middleware' => 'admin.user'], function () use ($namespacePrefix) {
// event(new RoutingAdmin()); @deprecated
Expand All @@ -31,15 +31,15 @@

try {
foreach (Voyager::model('DataType')::all() as $dataType) {
// Route::get($dataType->slug . '/replace_keyword', $breadController.'@replace-keyword')->name($dataType->slug.'.replaceKeyword');
// Route::get($dataType->slug . '/widgets', $breadController.'@widgets')->name($dataType->slug.'.widgets');
}
} catch (\InvalidArgumentException $e) {
throw new \InvalidArgumentException("Custom routes hasn't been configured because: ".$e->getMessage(), 1);
} catch (\Exception $e) {
// do nothing, might just be because table not yet migrated.
}

// Route::get('replace_keyword', $breadController.'@replace-keywordAll')->name('replaceKeyword-all');
// Route::get('widgets', $breadController.'@widgetsAll')->name('widgets-all');

// event(new RoutingAdminAfter()); @deprecated
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?php

namespace Joy\VoyagerReplaceKeyword\Actions;
namespace Joy\VoyagerWidgets\Actions;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Gate;
use TCG\Voyager\Actions\AbstractAction;
use TCG\Voyager\Facades\Voyager;

class ReplaceKeywordAction extends AbstractAction
class WidgetsAction extends AbstractAction
{
public function getTitle()
{
return __('joy-voyager-replace-keyword::generic.replace_keyword');
return __('joy-voyager-widgets::generic.widgets');
}

public function getIcon()
{
return 'voyager-replace-keyword';
return 'voyager-widgets';
}

public function getPolicy()
Expand All @@ -27,7 +27,7 @@ public function getPolicy()
public function getAttributes()
{
return [
'id' => 'replace_keyword_btn',
'id' => 'widgets_btn',
'class' => 'btn btn-primary',
'target' => '_blank',
];
Expand All @@ -40,14 +40,14 @@ public function getDefaultRoute()

public function shouldActionDisplayOnDataType()
{
return config('joy-voyager-replace-keyword.enabled', true) !== false
return config('joy-voyager-widgets.enabled', true) !== false
&& isInPatterns(
$this->dataType->slug,
config('joy-voyager-replace-keyword.allowed_slugs', ['*'])
config('joy-voyager-widgets.allowed_slugs', ['*'])
)
&& !isInPatterns(
$this->dataType->slug,
config('joy-voyager-replace-keyword.not_allowed_slugs', [])
config('joy-voyager-widgets.not_allowed_slugs', [])
);
}

Expand All @@ -65,7 +65,7 @@ public function massAction($ids, $comingFrom)
// Your macgic here

return redirect()->back()->with([
'message' => __('joy-voyager-replace-keyword::generic.successfully_replace_keyworded') . " {$dataType->getTranslatedAttribute('display_name_singular')}",
'message' => __('joy-voyager-widgets::generic.successfully_widgetsed') . " {$dataType->getTranslatedAttribute('display_name_singular')}",
'alert-type' => 'success',
]);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?php

namespace Joy\VoyagerReplaceKeyword\Console\Commands;
namespace Joy\VoyagerWidgets\Console\Commands;

use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;

class ReplaceKeyword extends Command
class Widgets extends Command
{
protected $name = 'joy-replace-keyword';
protected $name = 'joy-widgets';

protected $description = 'Joy Voyager ReplaceKeyworder';
protected $description = 'Joy Voyager Widgetser';

public function handle()
{
$this->output->title('Starting replace-keyword');
$this->output->title('Starting widgets');

// Your magic here

$this->output->success('ReplaceKeyword successful');
$this->output->success('Widgets successful');
}

/**
Expand Down Expand Up @@ -46,7 +46,7 @@ protected function getOptions()
'o',
InputOption::VALUE_OPTIONAL,
'The option1 description',
config('joy-voyager-replace-keyword.option1')
config('joy-voyager-widgets.option1')
],
];
}
Expand Down

0 comments on commit 4a41278

Please sign in to comment.