wamesk / stauses
package create Statuses
1.2.0
2023-11-14 10:30 UTC
Requires
README
2. Required
"wamesk/laravel-commands": "^1.0", "wamesk/utils": "^1.1", "wamesk/laravel-nova-language": "*", "kongulov/nova-tab-translatable": "^2.0", "norman-huth/nova-font-awesome-field": "^1.0"
3. Instalation
Wame\Statuses\StatusesServiceProvider::class,
php artisan vendor:publish --provider="Wame\Statuses\StatusesServiceProvider" php artisan vendor:publish --provider="Wame\LaravelNovaLanguage\PackageServiceProvider"
php artisan make:migration add_status_to_orders
/* add column to your model*/ $table->foreignUlid('status_id')->nullable()->constrained('statuses')->cascadeOnUpdate()->nullOnDelete(); php artisan migration
php artisan db:seed --class=LanguageSeeder
// php artisan db:seed --class=StatusSeeder
4. Usage
public function statuses(): BelongsTo { return $this->belongsTo(Status::class, 'status_id'); // Choose your model }
use App\Utils\Helpers\StatusFields; ...StatusFields::get($this, '0'), // set your model category if you use more categories
MenuItem::resource(Statuses::class),
MenuItem::resource(Languages::class),
Nova::mainMenu(function (Request $request, Menu $menu) { return $menu->append( MenuSection::make(__('status.menu.settings'), [ MenuItem::resource('\App\Nova\Status'), MenuItem::resource('\App\Nova\Language') ])->collapsable()->collapsible()->icon('cog') ); });
5. Configuration
edit translates resources/lang/sk/status.php
'selected' => [ '0' => 'prispevky', '1' => 'napady', ],
5. More options / extensions
uncomment this in Nova Model Status and add translates for models
Select::make(__('status.field.category'), 'model')
uncomment this
\NormanHuth\FontAwesomeField\FontAwesome::make(__('Icon'), 'icon'),
and add CSS to NovaSericeProvider
Nova::style('status_icons', resource_path('css/icon_fields.css'));
Add Language
Add or delete language in language menu,
set languages in wame-statuses.php
or tab-translatable.php
,
'required' => 'required_lang:sk', 'locales' => [ 'sk' ],
Check config/tab-transatable https://github.com/wamesk/laravel-nova-status/blob/main/config/tab-translatable.php