Skip to content

Commit

Permalink
compatibility for orchid 12
Browse files Browse the repository at this point in the history
  • Loading branch information
lintaba committed Apr 26, 2022
1 parent e1cdd5b commit 5248430
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"require": {
"php": "^8.0",
"illuminate/support": "^8.0|^9.0",
"orchid/platform": "^10.0|^11.0|^12.0"
"orchid/platform": "^12.0"
},
"require-dev": {
"roave/security-advisories": "dev-latest",
Expand Down
6 changes: 4 additions & 2 deletions src/OrchidTables.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Lintaba\OrchidTables;

use Lintaba\OrchidTables\Exceptions\MissingPackageException;
Expand All @@ -13,10 +15,10 @@ class OrchidTables
public function mixinTdExportFormattables(): void
{
if (!class_exists(Worksheet::class)) {
throw new MissingPackageException('PHPOffice/PhpSpreadsheet');
return;
}
if (!class_exists(Excel::class)) {
throw new MissingPackageException('maatwebsite/excel');
return;
}
$mix = app(CellExportFormattableMixin::class);

Expand Down
16 changes: 12 additions & 4 deletions src/OrchidTablesServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Lintaba\OrchidTables;

use Exception;
Expand Down Expand Up @@ -72,6 +74,11 @@ protected function bootForConsole(): void
$this->publishes([
__DIR__ . '/../config/orchid-tables.php' => config_path('orchid-tables.php'),
], 'orchid-tables.config');

$this->publishes([
__DIR__.'/../public/' => base_path('public/vendor/lintaba-orchid-tables/')
], ['orchid-tables-assets','laravel-assets']);

}

/**
Expand All @@ -81,11 +88,12 @@ protected function bootForConsole(): void
*/
private function registerResources(): self
{
$basepath = dirname(__DIR__);
$this->dashboard->addPublicDirectory('bulkselect', $basepath . '/public/');
View::composer('platform::app', function () {
$this->dashboard->registerResource('scripts', orchid_mix('/js/bulkselect.js', 'bulkselect'))
->registerResource('stylesheets', orchid_mix('/css/bulkselect.css', 'bulkselect'));
$this->dashboard
->registerResource('scripts',
mix('/js/bulkselect.js', 'vendor/lintaba-orchid-tables'))
->registerResource('stylesheets',
mix('/css/bulkselect.css', 'vendor/lintaba-orchid-tables'));
});

return $this;
Expand Down
4 changes: 2 additions & 2 deletions src/Screen/TDChecklist.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function checkboxSet($key, $value): self
*
* @return Factory|Application|\Illuminate\Contracts\View\View
*/
public function buildTd($repository)
public function buildTd($repository, ?object $loop = null)
{
$value = $repository->getKey();
$checkbox = CheckBox::make($this->sluggable() . '[]');
Expand Down Expand Up @@ -91,7 +91,7 @@ private function id(): string
/**
* @return string
*/
private function sluggable(): string
protected function sluggable(): string
{
return Str::slug($this->name) ?: 'checkbox';
}
Expand Down

0 comments on commit 5248430

Please sign in to comment.