Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Crudit Bundle Laravel Package

2lenet/crudit-bundle

Symfony bundle to rapidly build configurable CRUD back offices with SB Admin layout. Provides list views with pagination, sorting, actions, exports and batch ops, plus datasources, filters, menus, workflows, maps, markdown and Twig helpers.

View on GitHub
Deep Wiki
Context7

Tabs

You can add tabs in the show screen.

In your CrudConfig:

public function getTabs(): array
{
    return [
        'tab.name' => [Brick::new()]
    ];
}

You may use any brick. Below are common use cases.

History

When using Gedmo\Loggable, you can use HistoryConfig in tabs. It provides a view of your entity's modifications.

If using the Loggable interface, this tab is automatically added.

use Gedmo\Loggable\Loggable;

public class User implements Loggable

Note : if Gedmo ends up using PHP annotations, we may change the HistoryConfig to remove this requirement.

Otherwise, you have to add them like this:

use Lle\CruditBundle\Brick\HistoryBrick\HistoryConfig;

// ...

public function getTabs(): array
{
    return [
        'tab.history' => [
            HistoryConfig::new()
        ]
    ];
}

If you need to add custom history (such as additions/deletions in collections), you have to log it yourself by creating LogEntry entities from Gedmo, for example by implementing your own listener.

If you have some 1-1 relation for an entity you can add some entities to the History tabs

Just add a array with the datasource and the getter method to retrieve the entity from the main one.

exemple

'tab.history' => [
    HistoryConfig::new(['otherEntities' => [
        ['datasource' => $this->depistageL1Datasource, 'method' => 'getDepistageL1'],
        ['datasource' => $this->depistageL2Datasource, 'method' => 'getDepistageL2'],
        ['datasource' => $this->bdiDatasource, 'method' => 'getBdi'],
        ['datasource' => $this->l2IADatasource, 'method' => 'getL2IA']
    ]]),
]

Roles

If you want to limit your tab to a role you can pass a third parameter to the addTabs function like this

$tabConf = TabConfig::new();
$tabConf->adds('tab.subResource', [
    SublistConfig::new('resource', $this->subResourceCrudConfig)
        ->setFields($this->subResourceCrudConfig->getFields(CrudConfigInterface::INDEX))
], 'ROLE_TEST');

How to display the tab under certain conditions

You can add conditions to the tab, using the resource or not, in order to decide whether to display the tab based on the data or the request.

To do this, simply use setDisplayIf (for the data) or setDisplayIfByRequest (for the request):

$tabConf = TabConfig::new();
$tabConf->adds('tab.subResource', [
    SublistConfig::new('subResourceField', $this->subResourceCrudConfig)
        ->setFields($this->subResourceCrudConfig->getFields(CrudConfigInterface::INDEX))
        ->setActions($this->subResourceCrudConfig->getItemActions()),
    FormConfig::new()
        ->setForm(SubResourceSublistType::class)
        ->setSublist('subResourceField')
        ->setDatasource($this->subResourceCrudConfig->getDatasource())
        ->setSuccessRedirectPath($this->getPath(CrudConfigInterface::SHOW)),
], 'ROLE_RESOURCE_TAB_SUBRESOURCE', fn(Resource $resource) => $resource->isActive(), fn(Request $request) => $request->query->has('actif'));

Sublists

See Sublists

Tags

See Tags

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
bugban/php-sdk
littlerocket/job-queue-bundle
graham-campbell/flysystem
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
directorytree/opensearch-client
directorytree/opensearch-adapter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php