Skip to content

[WIP] Next CRUD Version #5715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
25a2d08
Uploaders - Refactor and fixes (#5478)
pxpm Nov 7, 2024
5e19b52
trigger testing forkflow on PR
tabacitu Nov 25, 2024
4cab12a
Clean up uploaders (#5725)
pxpm Dec 5, 2024
ab85b4b
allow datatable url configuration (#5713)
pxpm Dec 5, 2024
51ca89b
use next branch for basset
pxpm Jan 7, 2025
012484f
require alpha version
pxpm Jan 22, 2025
55e09ef
bump basset version
pxpm Jan 22, 2025
17df67a
Lifecycle hooks for CRUD operations (#5687)
pxpm Feb 7, 2025
39e6f9b
"Agnostic" filters - decouple filters from datatables (#5714)
pxpm Feb 7, 2025
de4c238
bump basset version
pxpm Feb 27, 2025
fed8db0
Update composer.json
pxpm Mar 6, 2025
d901ea7
Apply fixes from StyleCI
StyleCIBot Mar 24, 2025
c80d637
datatable component (#5688)
pxpm Jun 9, 2025
f6fb8c9
move the list heading to the datatable component (#5808)
pxpm Jun 10, 2025
5087c1d
add Datagrid and Datalist components (#5810)
tabacitu Jun 19, 2025
c4bfb8f
Form component (no ajax form) (#5814)
pxpm Jun 24, 2025
562ddac
dataform component fixes (#5816)
pxpm Jun 24, 2025
b21d8c0
Added general chip blade file and chip widget (#5815)
tabacitu Jun 25, 2025
53c4ef9
Fix Form issues, Add *name* argument to forms (#5817)
pxpm Jun 25, 2025
c6bd8ce
Drop support for Laravel 10 and 11 (#5819)
tabacitu Jun 27, 2025
5a2517f
Fix hooks at setup level (#5818)
pxpm Jun 27, 2025
7a364e5
install dev-next version of generators
pxpm Jun 27, 2025
165fad2
Merge pull request #5820 from Laravel-Backpack/fix-install-of-generators
pxpm Jun 27, 2025
19d567a
require basset beta version (#5821)
tabacitu Jun 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 5 additions & 18 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: PHP Tests

on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'

Expand All @@ -19,25 +20,11 @@ jobs:
# run all combinations of the following, to make sure they're working together
matrix:
# os: [ubuntu-latest, macos-latest, windows-latest]
php: ['8.1', '8.2', '8.3', '8.4']
laravel: [^10.0, ^11.0, ^12.0]
dbal: [^3.0]
phpunit: [10.*, 11.*]
php: ['8.2', '8.3', '8.4']
laravel: [^12.0]
dbal: [^4.0]
phpunit: [11.*]
dependency-version: [stable] # to add: lowest
exclude:
- laravel: "^11.0"
php: "8.1"
dbal: "^3.0"
- laravel: "^12.0"
php: "8.1"
dbal: "^3.0"
- laravel: "^12.0"
php: "8.2"
dbal: "^3.0"
- phpunit: "11.*"
laravel: "^10.0"
- phpunit: "10.*"
laravel: "^12.0"

name: PHP ${{ matrix.php }}, Laravel ${{ matrix.laravel }}, PHPUnit ${{ matrix.phpunit }}, DBAL ${{ matrix.dbal }} --prefer-${{ matrix.dependency-version }}

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ composer.lock
.phpunit.result.cache
src/public/packages/
/.phpunit.cache
coverage/

17 changes: 10 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@
}
],
"require": {
"laravel/framework": "^10.0|^11.0|^12",
"backpack/basset": "^1.1.1|^1.3.2",
"laravel/framework": "^12",
"backpack/basset": "^2.0.0-beta",
"creativeorange/gravatar": "^1.0",
"prologue/alerts": "^1.0",
"doctrine/dbal": "^3.0|^4.0",
"doctrine/dbal": "^4.0",
"guzzlehttp/guzzle": "^7.0"
},
"require-dev": {
"phpunit/phpunit": "^10.0|^9.0|^11.0",
"orchestra/testbench": "^8.0|^9.0|^10.0",
"phpunit/phpunit": "^11.0",
"orchestra/testbench": "^10.0",
"spatie/laravel-translatable": "^6.0"
},
"autoload": {
Expand All @@ -62,9 +62,12 @@
]
},
"scripts": {
"test": "vendor/bin/phpunit --testdox",
"test": [
"@putenv XDEBUG_MODE=off",
"vendor/bin/phpunit"
],
"test-failing": "vendor/bin/phpunit --order-by=defects --stop-on-failure",
"test-coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text"
"test-coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-html=coverage"
},
"extra": {
"branch-alias": {
Expand Down
3 changes: 3 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<include>
<directory suffix=".php">./src/app/Library/CrudPanel/Traits/</directory>
<directory>./src/app/Library/Validation/</directory>
<directory>./src/app/Library/Uploaders/</directory>
<directory suffix=".php">./src/app/Library/CrudPanel/</directory>
<directory suffix=".php">./src/app/Models/Traits/</directory>
<file>./src/app/Library/Widget.php</file>
Expand All @@ -35,9 +36,11 @@
</source>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="BCRYPT_ROUNDS" value="12"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_FOREIGN_KEYS" value="true"/>
<env name="DB_DATABASE" value=":memory:"/>
<env name="MAIL_MAILER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
Expand Down
56 changes: 49 additions & 7 deletions src/BackpackServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
use Backpack\Basset\Facades\Basset;
use Backpack\CRUD\app\Http\Middleware\EnsureEmailVerification;
use Backpack\CRUD\app\Http\Middleware\ThrottlePasswordRecovery;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanel;
use Backpack\CRUD\app\Library\Database\DatabaseSchema;
use Backpack\CRUD\app\Library\Uploaders\Support\UploadersRepository;
use Illuminate\Contracts\Debug\ExceptionHandler;
use Illuminate\Routing\Router;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\File;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
use Illuminate\View\Compilers\BladeCompiler;
Expand Down Expand Up @@ -78,19 +78,29 @@ public function register()
$this->loadViewsWithFallbacks('crud');
$this->loadViewsWithFallbacks('ui', 'backpack.ui');
$this->loadViewNamespace('widgets', 'backpack.ui::widgets');
ViewNamespaces::addFor('widgets', 'crud::widgets');

$this->loadViewComponents();
$this->registerDynamicBladeComponents();

$this->registerBackpackErrorViews();

// Bind the CrudPanel object to Laravel's service container
$this->app->scoped('crud', function ($app) {
return new CrudPanel();
$this->app->bind('crud', function ($app) {
return CrudManager::identifyCrudPanel();
});

$this->app->scoped('CrudManager', function ($app) {
return new CrudPanelManager();
});

$this->app->scoped('DatabaseSchema', function ($app) {
return new DatabaseSchema();
});

$this->app->scoped('BackpackLifecycleHooks', function ($app) {
return new app\Library\CrudPanel\Hooks\LifecycleHooks();
});

$this->app->singleton('BackpackViewNamespaces', function ($app) {
return new ViewNamespaces();
});
Expand Down Expand Up @@ -177,7 +187,7 @@ public function publishFiles()
/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
* @param Router $router
* @return void
*/
public function setupRoutes(Router $router)
Expand All @@ -196,7 +206,7 @@ public function setupRoutes(Router $router)
/**
* Load custom routes file.
*
* @param \Illuminate\Routing\Router $router
* @param Router $router
* @return void
*/
public function setupCustomRoutes(Router $router)
Expand Down Expand Up @@ -314,6 +324,38 @@ public function loadViewComponents()
});
}

/**
* Register dynamic Blade components from the Components directory.
*
* Any Blade component classes that are in that directory will be registered
* as dynamic components with the 'bp-{component-name}' prefix.
*/
private function registerDynamicBladeComponents()
{
$path = __DIR__.'/app/View/Components';
$namespace = 'Backpack\\CRUD\\app\\View\\Components';

if (! is_dir($path)) {
return;
}

foreach (File::allFiles($path) as $file) {
$relativePath = str_replace(
['/', '.php'],
['\\', ''],
Str::after($file->getRealPath(), realpath($path).DIRECTORY_SEPARATOR)
);

$class = $namespace.'\\'.$relativePath;

// Check if the class exists and is a subclass of Illuminate\View\Component
// This ensures that only valid Blade components are registered.
if (class_exists($class) && is_subclass_of($class, \Illuminate\View\Component::class)) {
Blade::component('bp-'.Str::kebab(class_basename($class)), $class);
}
}
}

/**
* Load the Backpack helper methods, for convenience.
*/
Expand All @@ -329,7 +371,7 @@ public function loadHelpers()
*/
public function provides()
{
return ['crud', 'widgets', 'BackpackViewNamespaces', 'DatabaseSchema', 'UploadersRepository'];
return ['widgets', 'BackpackViewNamespaces', 'DatabaseSchema', 'UploadersRepository', 'CrudManager'];
}

private function registerBackpackErrorViews()
Expand Down
16 changes: 16 additions & 0 deletions src/CrudManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Backpack\CRUD;

use Illuminate\Support\Facades\Facade;

/**
* @see CrudPanelManager
*/
class CrudManager extends Facade
{
protected static function getFacadeAccessor()
{
return 'CrudManager';
}
}
Loading