You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to obtain a list of all assets using Nova::allScripts & Nova::allStyles in a console command not all the items are included. Specifically tool assets are not found.
Detailed steps to reproduce the issue on a fresh Nova installation:
Create a tool with assets
Create a command with something like:
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Http\Request;
use Laravel\Nova\Nova;
use Illuminate\Support\Facades\Auth;
use App\Models\User;
class CombineNovaTools extends Command
{
/**
* The console command description.
*
* @var string
*/
protected $description = 'Combines all nova package scripts and styles';
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'combine:nova-tools';
/**
* Create a new command instance.
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
Auth::login(User::where('role', '=', 'Admin')->first(), true); // change to a user with full access to nova
$url = config('app.url') . '/dashboard';
app()->handle(Request::create($url));
$this->info('Combining nova package js and css');
$this->combineTools();
}
private function combineTools(): void
{
$assets = [
'allScripts' => 'js',
'allStyles' => 'css',
// 'themeStyles' => 'css',
];
$list = [];
foreach ($assets as $method => $type) {
foreach (Nova::{$method}() as $file) {
$this->info($file);
$list[] = [
'type' => $type,
'file' => $file,
];
}
}
dd($list);
\file_put_contents(base_path('novatools.json'), json_encode($list));
}
}
Most of the assets from cards etc are loaded successfully however neither the css or js are found for a nova tool.
As a test I also tried dd'ing Nova::AllScripts and Nova::AllStyles in a package and the missing tool assets were visible fine so I think this bug occurs within the console commands only.
This discussion was converted from issue #3506 on August 12, 2021 16:14.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Description:
When trying to obtain a list of all assets using
Nova::allScripts
&Nova::allStyles
in a console command not all the items are included. Specifically tool assets are not found.Detailed steps to reproduce the issue on a fresh Nova installation:
Most of the assets from cards etc are loaded successfully however neither the css or js are found for a nova tool.
As a test I also tried dd'ing
Nova::AllScripts
andNova::AllStyles
in a package and the missing tool assets were visible fine so I think this bug occurs within the console commands only.Thank you for your time.
Beta Was this translation helpful? Give feedback.
All reactions