Skip to content

Commit be9ca8a

Browse files
committed
Merge branch 'main' into error-page-translations
# Conflicts: # src/resources/views/ui/errors/layout.blade.php
2 parents 1f734e4 + 6305d3e commit be9ca8a

32 files changed

+475
-259
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"require": {
3838
"laravel/framework": "^10.0",
3939
"prologue/alerts": "^1.0",
40-
"backpack/basset": "^1.0.0",
40+
"backpack/basset": "^1.1.1",
4141
"creativeorange/gravatar": "~1.0",
4242
"doctrine/dbal": "^3.0",
4343
"guzzlehttp/guzzle": "^7.0"

src/BackpackServiceProvider.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Illuminate\Support\Facades\Blade;
1414
use Illuminate\Support\ServiceProvider;
1515
use Illuminate\Support\Str;
16+
use Illuminate\View\Compilers\BladeCompiler;
1617

1718
class BackpackServiceProvider extends ServiceProvider
1819
{
@@ -22,7 +23,6 @@ class BackpackServiceProvider extends ServiceProvider
2223
\Backpack\CRUD\app\Console\Commands\Install::class,
2324
\Backpack\CRUD\app\Console\Commands\AddMenuContent::class,
2425
\Backpack\CRUD\app\Console\Commands\AddCustomRouteContent::class,
25-
\Backpack\CRUD\app\Console\Commands\PublishAssets::class,
2626
\Backpack\CRUD\app\Console\Commands\Version::class,
2727
\Backpack\CRUD\app\Console\Commands\CreateUser::class,
2828
\Backpack\CRUD\app\Console\Commands\PublishBackpackMiddleware::class,
@@ -275,10 +275,13 @@ public function loadConfigs()
275275

276276
// add the backpack_users password broker to the configuration
277277
$laravelAuthPasswordBrokers = app()->config['auth.passwords'];
278+
$laravelFirstPasswordBroker = is_array($laravelAuthPasswordBrokers) && current($laravelAuthPasswordBrokers) ?
279+
current($laravelAuthPasswordBrokers)['table'] :
280+
'';
278281

279282
$backpackPasswordBrokerTable = config('backpack.base.password_resets_table') ??
280283
config('auth.passwords.users.table') ??
281-
current($laravelAuthPasswordBrokers)['table'];
284+
$laravelFirstPasswordBroker;
282285

283286
app()->config['auth.passwords'] = $laravelAuthPasswordBrokers +
284287
[
@@ -302,7 +305,9 @@ public function loadConfigs()
302305

303306
public function loadViewComponents()
304307
{
305-
Blade::componentNamespace('Backpack\\CRUD\\app\\View\\Components', 'backpack');
308+
$this->app->afterResolving(BladeCompiler::class, function () {
309+
Blade::componentNamespace('Backpack\\CRUD\\app\\View\\Components', 'backpack');
310+
});
306311
}
307312

308313
/**

src/app/Console/Commands/Install.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ class Install extends Command
4949
* @var array
5050
*/
5151
protected $themes = [
52-
Themes\RequireThemeCoreuiv2::class,
53-
Themes\RequireThemeCoreuiv4::class,
5452
Themes\RequireThemeTabler::class,
53+
Themes\RequireThemeCoreuiv4::class,
54+
Themes\RequireThemeCoreuiv2::class,
5555
];
5656

5757
/**
@@ -93,7 +93,7 @@ public function handle()
9393

9494
// Install Backpack Basset
9595
$this->progressBlock('Installing Basset');
96-
$this->executeArtisanProcess('basset:install --no-interaction');
96+
$this->executeArtisanProcess('basset:install --no-check --no-interaction');
9797
$this->closeProgressBlock();
9898

9999
// Optional commands
@@ -109,10 +109,12 @@ public function handle()
109109
} elseif (! $this->isAnyThemeInstalled()) {
110110
// Install default theme
111111
$this->progressBlock('Installing default theme');
112-
$this->executeArtisanProcess('backpack:require:theme-coreuiv2');
112+
$this->executeArtisanProcess('backpack:require:theme-tabler');
113113
$this->closeProgressBlock();
114114
}
115115

116+
//execute basset checks
117+
$this->call('basset:check');
116118
// Done
117119
$url = Str::of(config('app.url'))->finish('/')->append('admin/');
118120
$this->infoBlock('Backpack installation complete.', 'done');
@@ -309,14 +311,14 @@ private function installTheme()
309311
}, 0);
310312

311313
$total = 0;
312-
$input = (int) $this->listChoice('Which Backpack theme would you like to install? <fg=gray>(enter option number: 1, 2 or 3)</>', $this->themes()->toArray());
314+
$input = (int) $this->listChoice('Which Backpack theme would you like to install? <fg=gray>(enter option number: 1, 2 or 3)</>', $this->themes()->toArray(), 1);
313315

314316
if ($input < 1 || $input > $this->themes()->count()) {
315317
$this->deleteLines(3);
316-
$this->note('Skipping installing a theme.');
318+
$this->note('Unknown theme. Using default theme value.');
317319
$this->newLine();
318320

319-
return;
321+
$input = 1;
320322
}
321323

322324
// Clear list

src/app/Console/Commands/PublishAssets.php

Lines changed: 0 additions & 53 deletions
This file was deleted.

src/app/Console/Commands/Themes/RequireThemeCoreuiv2.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ class RequireThemeCoreuiv2 extends Command
2929
* @var array
3030
*/
3131
public static $addon = [
32-
'name' => 'CoreUIv2 <fg=green>(default)</>',
32+
'name' => 'CoreUIv2',
3333
'description' => [
34-
'UI provided by CoreUIv2, a Boostrap 4 template.',
34+
'UI provided by CoreUIv2, a Boostrap 4 template. Considered legacy, but useful for IE support.',
3535
'<fg=blue>https://github.com/laravel-backpack/theme-coreuiv2/</>',
3636
],
3737
'repo' => 'backpack/theme-coreuiv2',

src/app/Console/Commands/Themes/RequireThemeCoreuiv4.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class RequireThemeCoreuiv4 extends Command
2929
* @var array
3030
*/
3131
public static $addon = [
32-
'name' => 'CoreUIv4 <fg=yellow>(public beta)</>',
32+
'name' => 'CoreUIv4',
3333
'description' => [
3434
'UI provided by CoreUIv4, a Boostrap 5 template.',
3535
'<fg=blue>https://github.com/laravel-backpack/theme-coreuiv4/</>',

src/app/Console/Commands/Themes/RequireThemeTabler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ class RequireThemeTabler extends Command
2929
* @var array
3030
*/
3131
public static $addon = [
32-
'name' => 'Tabler',
32+
'name' => 'Tabler <fg=green>(default)</>',
3333
'description' => [
34-
'UI provided by Tabler, a Boostrap 5 template.',
34+
'UI provided by Tabler, a Boostrap 5 template. Lots of new features, including a dark mode.',
3535
'<fg=blue>https://github.com/laravel-backpack/theme-tabler/</>',
3636
],
3737
'repo' => 'backpack/theme-tabler',

src/app/Exceptions/AccessDeniedException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ class AccessDeniedException extends Exception
1414
*/
1515
public function render($request)
1616
{
17-
return response(view('errors.403', ['exception' => $this]), 403);
17+
return abort(403, $this->getMessage());
1818
}
1919
}

src/app/Exceptions/BackpackProRequiredException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ public function render($request)
2020
break;
2121
}
2222

23-
return response(view('errors.500', ['exception' => $this]), 500);
23+
return abort(500, $this->getMessage());
2424
}
2525
}

src/app/Library/CrudPanel/CrudColumn.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ class CrudColumn
3838

3939
protected $attributes;
4040

41-
public function upload($upload = true)
41+
public function __construct($nameOrDefinitionArray)
4242
{
43-
$this->attributes['upload'] = $upload;
44-
45-
return $this->save();
46-
}
43+
if (is_array($nameOrDefinitionArray)) {
44+
$column = $this->crud()->addAndReturnColumn($nameOrDefinitionArray);
45+
$name = $column->getAttributes()['name'];
46+
} else {
47+
$name = $nameOrDefinitionArray;
48+
}
4749

48-
public function __construct($name)
49-
{
5050
$column = $this->crud()->firstColumnWhere('name', $name);
5151

5252
// if column exists
@@ -159,6 +159,13 @@ public function before($destinationColumn)
159159
return $this;
160160
}
161161

162+
public function upload($upload = true)
163+
{
164+
$this->attributes['upload'] = $upload;
165+
166+
return $this->save();
167+
}
168+
162169
/**
163170
* Make the current column the first one in the columns list.
164171
*

0 commit comments

Comments
 (0)