Closed telefoniero closed 2 years ago
Forgot to mention: this is MyIndexToolbarBtn.php file, so the name of the component is similar to what I use in my resource's file
Here is my composer.json file in a root filder.
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.1.3",
"acme/color-picker": "*",
"acme/quantity-tracker": "*",
"bernhardh/nova-dynamic-views": "^1.4",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.8.*",
"laravel/nova": "*",
"laravel/tinker": "^1.0",
"acme/my-index-toolbar-btn": "*"
},
"repositories": [
{
"type": "path",
"url": "./nova"
},
{
"type": "path",
"url": "./nova-components/ColorPicker"
},
{
"type": "path",
"url": "./nova-components/QuantityTracker"
},
{
"type": "path",
"url": "./nova-components/MyIndexToolbarBtn"
}
],
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^7.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
}
@bernhardh, there is also no default method for custom-index-toolbar found. Idk, if I've done everything properly.
First of all: I haven't used this package nor nova for over a year. So maybe something changed in the meantime. My old installations of nova are still working with this package. But I will try to help you anyway.
What is the content of your tools.js
file of your MyIndexToolbarBtn
?
Maybe this helps, this is a sample component which I require like this in the composer.json
of a test project:
{
...
"require": {
"acme/custom-resource-toolbar": "*",
},
...
"repositories": [
...
{
"type": "path",
"url": "./nova-components/CustomResourceToolbar"
},
]
}
In the resource:
/**
* Using the `custom-index-header` placeholder component
*/
public function customIndexToolbarComponents()
{
return CustomComponents::make('flex w-full justify-end items-center mx-3')
->addItem('custom-resource-toolbar', [
'label' => 'Button 1'
])
->addItem('custom-resource-toolbar', [
'label' => 'Button 2'
]);
}
Which result to this:
And attached you will find the component itself.
Hope this helps.
@bernhardh, hi again! There was an error on assets' compiling, which i didn't notice. There's no problem anymore. Thanks a lot for your attention!
Hello! I've done all steps according to your instruction (applying screens), but there are no words, as it is by default.
This is NovaServiceProvider.php file.
This is my Record's resource file.
There is a 'watch' process working on in terminal, on my ToolbarBtn.
This is basic template of a component.
And this is Nova's Record page, there are no new components.
Please, help!