add nova
This commit is contained in:
10
nova/src/Console/resource-tool-stubs/.gitignore
vendored
Normal file
10
nova/src/Console/resource-tool-stubs/.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/.idea
|
||||
/vendor
|
||||
/node_modules
|
||||
package-lock.json
|
||||
composer.phar
|
||||
composer.lock
|
||||
phpunit.xml
|
||||
.phpunit.result.cache
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
29
nova/src/Console/resource-tool-stubs/composer.json
Normal file
29
nova/src/Console/resource-tool-stubs/composer.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "{{ name }}",
|
||||
"description": "A Laravel Nova resource tool.",
|
||||
"keywords": [
|
||||
"laravel",
|
||||
"nova"
|
||||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7.3|^8.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"{{ escapedNamespace }}\\": "src/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"{{ escapedNamespace }}\\ToolServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
33
nova/src/Console/resource-tool-stubs/nova.mix.js
Normal file
33
nova/src/Console/resource-tool-stubs/nova.mix.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const mix = require('laravel-mix')
|
||||
const webpack = require('webpack')
|
||||
const path = require('path')
|
||||
|
||||
class NovaExtension {
|
||||
name() {
|
||||
return 'nova-extension'
|
||||
}
|
||||
|
||||
register(name) {
|
||||
this.name = name
|
||||
}
|
||||
|
||||
webpackConfig(webpackConfig) {
|
||||
webpackConfig.externals = {
|
||||
vue: 'Vue',
|
||||
}
|
||||
|
||||
webpackConfig.resolve.alias = {
|
||||
...(webpackConfig.resolve.alias || {}),
|
||||
'laravel-nova': path.join(
|
||||
__dirname,
|
||||
'../../vendor/laravel/nova/resources/js/mixins/packages.js'
|
||||
),
|
||||
}
|
||||
|
||||
webpackConfig.output = {
|
||||
uniqueName: this.name,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mix.extend('nova', new NovaExtension())
|
||||
20
nova/src/Console/resource-tool-stubs/package.json
Normal file
20
nova/src/Console/resource-tool-stubs/package.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "npm run development",
|
||||
"development": "mix",
|
||||
"watch": "mix watch",
|
||||
"watch-poll": "mix watch -- --watch-options-poll=1000",
|
||||
"hot": "mix watch --hot",
|
||||
"prod": "npm run production",
|
||||
"production": "mix --production",
|
||||
"nova:install": "npm --prefix='../../vendor/laravel/nova' ci"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/compiler-sfc": "^3.2.22",
|
||||
"laravel-mix": "^6.0.41",
|
||||
"postcss": "^8.3.11",
|
||||
"vue-loader": "^16.8.3"
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
1
nova/src/Console/resource-tool-stubs/postcss.config.js
Normal file
1
nova/src/Console/resource-tool-stubs/postcss.config.js
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = {}
|
||||
@@ -0,0 +1 @@
|
||||
/* Nova Resource Tool CSS */
|
||||
@@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<div>{{ title }}</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: ['resourceName', 'resourceId', 'panel'],
|
||||
|
||||
mounted() {
|
||||
//
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,5 @@
|
||||
import Tool from './components/Tool'
|
||||
|
||||
Nova.booting((app, store) => {
|
||||
app.component('{{ component }}', Tool)
|
||||
})
|
||||
19
nova/src/Console/resource-tool-stubs/routes/api.stub
Normal file
19
nova/src/Console/resource-tool-stubs/routes/api.stub
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Tool API Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you may register API routes for your tool. These routes
|
||||
| are loaded by the ServiceProvider of your tool. You're free to add
|
||||
| as many additional routes to this file as your tool may require.
|
||||
|
|
||||
*/
|
||||
|
||||
// Route::get('/endpoint', function (Request $request) {
|
||||
// //
|
||||
// });
|
||||
28
nova/src/Console/resource-tool-stubs/src/Tool.stub
Normal file
28
nova/src/Console/resource-tool-stubs/src/Tool.stub
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Laravel\Nova\ResourceTool;
|
||||
|
||||
class {{ class }} extends ResourceTool
|
||||
{
|
||||
/**
|
||||
* Get the displayable name of the resource tool.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function name()
|
||||
{
|
||||
return '{{ title }}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the component name for the resource tool.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function component()
|
||||
{
|
||||
return '{{ component }}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace {{ namespace }};
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Laravel\Nova\Events\ServingNova;
|
||||
use Laravel\Nova\Nova;
|
||||
|
||||
class ToolServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->app->booted(function () {
|
||||
$this->routes();
|
||||
});
|
||||
|
||||
Nova::serving(function (ServingNova $event) {
|
||||
Nova::script('{{ component }}', __DIR__.'/../dist/js/tool.js');
|
||||
Nova::style('{{ component }}', __DIR__.'/../dist/css/tool.css');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the tool's routes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function routes()
|
||||
{
|
||||
if ($this->app->routesAreCached()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Route::middleware(['nova'])
|
||||
->prefix('nova-vendor/{{ name }}')
|
||||
->group(__DIR__.'/../routes/api.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
10
nova/src/Console/resource-tool-stubs/webpack.mix.js
Normal file
10
nova/src/Console/resource-tool-stubs/webpack.mix.js
Normal file
@@ -0,0 +1,10 @@
|
||||
let mix = require('laravel-mix')
|
||||
|
||||
require('./nova.mix')
|
||||
|
||||
mix
|
||||
.setPublicPath('dist')
|
||||
.js('resources/js/tool.js', 'js')
|
||||
.vue({ version: 3 })
|
||||
.css('resources/css/tool.css', 'css')
|
||||
.nova('{{ name }}')
|
||||
Reference in New Issue
Block a user