first upload all files
This commit is contained in:
41
app/Scaffold/Module/stubs/admin-controller.stub
Normal file
41
app/Scaffold/Module/stubs/admin-controller.stub
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\$MODULE_NAME$\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Routing\Controller;
|
||||
use Modules\Admin\Traits\HasCrudActions;
|
||||
use Modules\$MODULE_NAME$\Entities\$ENTITY_NAME$;
|
||||
use Modules\$MODULE_NAME$\Http\Requests\Save$ENTITY_NAME$Request;
|
||||
|
||||
class $ENTITY_NAME$Controller extends Controller
|
||||
{
|
||||
use HasCrudActions;
|
||||
|
||||
/**
|
||||
* Model for the resource.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = $ENTITY_NAME$::class;
|
||||
|
||||
/**
|
||||
* Label of the resource.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $label = '$LOWERCASE_MODULE_NAME$::$PLURAL_SNAKE_CASE_ENTITY_NAME$.$SNAKE_CASE_ENTITY_NAME$';
|
||||
|
||||
/**
|
||||
* View path of the resource.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $viewPath = '$LOWERCASE_MODULE_NAME$::admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$';
|
||||
|
||||
/**
|
||||
* Form requests for the resource.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $validation = Save$ENTITY_NAME$Request::class;
|
||||
}
|
||||
22
app/Scaffold/Module/stubs/config/assets.stub
Normal file
22
app/Scaffold/Module/stubs/config/assets.stub
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Define which assets will be available through the asset manager
|
||||
|--------------------------------------------------------------------------
|
||||
| These assets are registered on the asset manager
|
||||
*/
|
||||
'all_assets' => [
|
||||
'admin.$LOWERCASE_MODULE$.css' => ['module' => '$LOWERCASE_MODULE$:admin/css/$LOWERCASE_MODULE$.css'],
|
||||
'admin.$LOWERCASE_MODULE$.js' => ['module' => '$LOWERCASE_MODULE$:admin/js/$LOWERCASE_MODULE$.js'],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Define which default assets will always be included in your pages
|
||||
| through the asset pipeline
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'required_assets' => [],
|
||||
];
|
||||
8
app/Scaffold/Module/stubs/config/permissions-append.stub
Normal file
8
app/Scaffold/Module/stubs/config/permissions-append.stub
Normal file
@@ -0,0 +1,8 @@
|
||||
'admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$' => [
|
||||
'index' => '$LOWERCASE_MODULE_NAME$::permissions.index',
|
||||
'create' => '$LOWERCASE_MODULE_NAME$::permissions.create',
|
||||
'edit' => '$LOWERCASE_MODULE_NAME$::permissions.edit',
|
||||
'destroy' => '$LOWERCASE_MODULE_NAME$::permissions.destroy',
|
||||
],
|
||||
|
||||
// append
|
||||
5
app/Scaffold/Module/stubs/config/permissions.stub
Normal file
5
app/Scaffold/Module/stubs/config/permissions.stub
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
// append
|
||||
];
|
||||
39
app/Scaffold/Module/stubs/entities/entity.stub
Normal file
39
app/Scaffold/Module/stubs/entities/entity.stub
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\$MODULE_NAME$\Entities;
|
||||
|
||||
use Modules\Support\Eloquent\Model;
|
||||
use Modules\Support\Eloquent\Translatable;
|
||||
|
||||
class $ENTITY_NAME$ extends Model
|
||||
{
|
||||
use Translatable;
|
||||
|
||||
/**
|
||||
* The relations to eager load on every query.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $with = ['translations'];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [];
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $translatedAttributes = [];
|
||||
}
|
||||
15
app/Scaffold/Module/stubs/entities/translation-entity.stub
Normal file
15
app/Scaffold/Module/stubs/entities/translation-entity.stub
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\$MODULE_NAME$\Entities;
|
||||
|
||||
use Modules\Support\Eloquent\TranslationModel;
|
||||
|
||||
class $ENTITY_NAME$Translation extends TranslationModel
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [];
|
||||
}
|
||||
5
app/Scaffold/Module/stubs/lang/attributes.stub
Normal file
5
app/Scaffold/Module/stubs/lang/attributes.stub
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
//
|
||||
];
|
||||
6
app/Scaffold/Module/stubs/lang/entity.stub
Normal file
6
app/Scaffold/Module/stubs/lang/entity.stub
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'$SNAKE_CASE_ENTITY_NAME$' => '$TITLE_CASE_ENTITY_NAME$',
|
||||
'$PLURAL_SNAKE_CASE_ENTITY_NAME$' => '$PLURAL_TITLE_CASE_ENTITY_NAME$',
|
||||
];
|
||||
8
app/Scaffold/Module/stubs/lang/permissions.stub
Normal file
8
app/Scaffold/Module/stubs/lang/permissions.stub
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'index' => 'Index $TITLE_CASE_ENTITY_NAME$',
|
||||
'create' => 'Create $TITLE_CASE_ENTITY_NAME$',
|
||||
'edit' => 'Edit $TITLE_CASE_ENTITY_NAME$',
|
||||
'destroy' => 'Delete $TITLE_CASE_ENTITY_NAME$',
|
||||
];
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class Create$PLURAL_ENTITY_NAME$Table extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('$PLURAL_SNAKE_CASE_ENTITY_NAME$', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('$PLURAL_SNAKE_CASE_ENTITY_NAME$');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class Create$ENTITY_NAME$TranslationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('$SNAKE_CASE_ENTITY_NAME$_translations', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('$SNAKE_CASE_ENTITY_NAME$_id')->unsigned();
|
||||
$table->string('locale');
|
||||
|
||||
$table->unique(['$SNAKE_CASE_ENTITY_NAME$_id', 'locale']);
|
||||
$table->foreign('$SNAKE_CASE_ENTITY_NAME$_id')->references('id')->on('$PLURAL_SNAKE_CASE_ENTITY_NAME$')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('$SNAKE_CASE_ENTITY_NAME$_translations');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\$MODULE$\Providers;
|
||||
|
||||
use Modules\Support\Traits\AddsAsset;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class $MODULE$ServiceProvider extends ServiceProvider
|
||||
{
|
||||
use AddsAsset;
|
||||
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
37
app/Scaffold/Module/stubs/routes/routes-append.stub
Normal file
37
app/Scaffold/Module/stubs/routes/routes-append.stub
Normal file
@@ -0,0 +1,37 @@
|
||||
Route::get('$PLURAL_KEBAB_CASE_ENTITY_NAME$', [
|
||||
'as' => 'admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.index',
|
||||
'uses' => '$ENTITY_NAME$Controller@index',
|
||||
'middleware' => 'can:admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.index',
|
||||
]);
|
||||
|
||||
Route::get('$PLURAL_KEBAB_CASE_ENTITY_NAME$/create', [
|
||||
'as' => 'admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.create',
|
||||
'uses' => '$ENTITY_NAME$Controller@create',
|
||||
'middleware' => 'can:admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.create',
|
||||
]);
|
||||
|
||||
Route::post('$PLURAL_KEBAB_CASE_ENTITY_NAME$', [
|
||||
'as' => 'admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.store',
|
||||
'uses' => '$ENTITY_NAME$Controller@store',
|
||||
'middleware' => 'can:admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.create',
|
||||
]);
|
||||
|
||||
Route::get('$PLURAL_KEBAB_CASE_ENTITY_NAME$/{id}/edit', [
|
||||
'as' => 'admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.edit',
|
||||
'uses' => '$ENTITY_NAME$Controller@edit',
|
||||
'middleware' => 'can:admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.edit',
|
||||
]);
|
||||
|
||||
Route::put('$PLURAL_KEBAB_CASE_ENTITY_NAME$/{id}', [
|
||||
'as' => 'admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.update',
|
||||
'uses' => '$ENTITY_NAME$Controller@update',
|
||||
'middleware' => 'can:admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.edit',
|
||||
]);
|
||||
|
||||
Route::delete('$PLURAL_KEBAB_CASE_ENTITY_NAME$/{ids?}', [
|
||||
'as' => 'admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.destroy',
|
||||
'uses' => '$ENTITY_NAME$Controller@destroy',
|
||||
'middleware' => 'can:admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.destroy',
|
||||
]);
|
||||
|
||||
// append
|
||||
5
app/Scaffold/Module/stubs/routes/routes.stub
Normal file
5
app/Scaffold/Module/stubs/routes/routes.stub
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
// append
|
||||
25
app/Scaffold/Module/stubs/save-entity-request.stub
Normal file
25
app/Scaffold/Module/stubs/save-entity-request.stub
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\$MODULE_NAME$\Http\Requests;
|
||||
|
||||
use Modules\Core\Http\Requests\Request;
|
||||
|
||||
class Save$ENTITY_NAME$Request extends Request
|
||||
{
|
||||
/**
|
||||
* Available attributes.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $availableAttributes = '$LOWERCASE_MODULE_NAME$::attributes';
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
$item->item(trans('$LOWERCASE_MODULE_NAME$::$PLURAL_SNAKE_CASE_ENTITY_NAME$.$PLURAL_SNAKE_CASE_ENTITY_NAME$'), function (Item $item) {
|
||||
$item->weight(5);
|
||||
$item->route('admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.index');
|
||||
$item->authorize(
|
||||
$this->auth->hasAccess('admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.index')
|
||||
);
|
||||
});
|
||||
|
||||
// append
|
||||
26
app/Scaffold/Module/stubs/sidebar/sidebar-extender.stub
Normal file
26
app/Scaffold/Module/stubs/sidebar/sidebar-extender.stub
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\$MODULE_NAME$\Sidebar;
|
||||
|
||||
use Maatwebsite\Sidebar\Menu;
|
||||
use Maatwebsite\Sidebar\Item;
|
||||
use Maatwebsite\Sidebar\Group;
|
||||
use Modules\Admin\Sidebar\BaseSidebarExtender;
|
||||
|
||||
class SidebarExtender extends BaseSidebarExtender
|
||||
{
|
||||
public function extend(Menu $menu)
|
||||
{
|
||||
$menu->group(trans('admin::sidebar.content'), function (Group $group) {
|
||||
$group->item(trans('$LOWERCASE_MODULE_NAME$::$PLURAL_SNAKE_CASE_ENTITY_NAME$.$PLURAL_SNAKE_CASE_ENTITY_NAME$'), function (Item $item) {
|
||||
$item->icon('fa fa-copy');
|
||||
$item->weight(0);
|
||||
$item->authorize(
|
||||
/* append */
|
||||
);
|
||||
|
||||
// append
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
16
app/Scaffold/Module/stubs/views/create.stub
Normal file
16
app/Scaffold/Module/stubs/views/create.stub
Normal file
@@ -0,0 +1,16 @@
|
||||
@extends('admin::layout')
|
||||
|
||||
@component('admin::components.page.header')
|
||||
@slot('title', trans('admin::resource.create', ['resource' => trans('$LOWERCASE_MODULE_NAME$::$PLURAL_SNAKE_CASE_ENTITY_NAME$.$SNAKE_CASE_ENTITY_NAME$')]))
|
||||
|
||||
<li><a href="{{ route('admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.index') }}">{{ trans('$LOWERCASE_MODULE_NAME$::$PLURAL_SNAKE_CASE_ENTITY_NAME$.$PLURAL_SNAKE_CASE_ENTITY_NAME$') }}</a></li>
|
||||
<li class="active">{{ trans('admin::resource.create', ['resource' => trans('$LOWERCASE_MODULE_NAME$::$PLURAL_SNAKE_CASE_ENTITY_NAME$.$SNAKE_CASE_ENTITY_NAME$')]) }}</li>
|
||||
@endcomponent
|
||||
|
||||
@section('content')
|
||||
<form method="POST" action="{{ route('admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.store') }}" class="form-horizontal" id="$KEBAB_CASE_ENTITY_NAME$-create-form" novalidate>
|
||||
{{ csrf_field() }}
|
||||
</form>
|
||||
@endsection
|
||||
|
||||
@include('$LOWERCASE_MODULE_NAME$::admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.partials.shortcuts')
|
||||
18
app/Scaffold/Module/stubs/views/edit.stub
Normal file
18
app/Scaffold/Module/stubs/views/edit.stub
Normal file
@@ -0,0 +1,18 @@
|
||||
@extends('admin::layout')
|
||||
|
||||
@component('admin::components.page.header')
|
||||
@slot('title', trans('admin::resource.edit', ['resource' => trans('$LOWERCASE_MODULE_NAME$::$PLURAL_SNAKE_CASE_ENTITY_NAME$.$SNAKE_CASE_ENTITY_NAME$')]))
|
||||
@slot('subtitle', '')
|
||||
|
||||
<li><a href="{{ route('admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.index') }}">{{ trans('$LOWERCASE_MODULE_NAME$::$PLURAL_SNAKE_CASE_ENTITY_NAME$.$PLURAL_SNAKE_CASE_ENTITY_NAME$') }}</a></li>
|
||||
<li class="active">{{ trans('admin::resource.edit', ['resource' => trans('$LOWERCASE_MODULE_NAME$::$PLURAL_SNAKE_CASE_ENTITY_NAME$.$SNAKE_CASE_ENTITY_NAME$')]) }}</li>
|
||||
@endcomponent
|
||||
|
||||
@section('content')
|
||||
<form method="POST" action="{{ route('admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.update', $$LCFIRST_ENTITY_NAME$) }}" class="form-horizontal" id="$KEBAB_CASE_ENTITY_NAME$-edit-form" novalidate>
|
||||
{{ csrf_field() }}
|
||||
{{ method_field('put') }}
|
||||
</form>
|
||||
@endsection
|
||||
|
||||
@include('$LOWERCASE_MODULE_NAME$::admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.partials.shortcuts')
|
||||
1
app/Scaffold/Module/stubs/views/fields.stub
Normal file
1
app/Scaffold/Module/stubs/views/fields.stub
Normal file
@@ -0,0 +1 @@
|
||||
@include('$LOWERCASE_MODULE_NAME$::$PLURAL_SNAKE_CASE_ENTITY_NAME$.$LOWERCASE_ENTITY_NAME$.partials.shortcuts')
|
||||
32
app/Scaffold/Module/stubs/views/index.stub
Normal file
32
app/Scaffold/Module/stubs/views/index.stub
Normal file
@@ -0,0 +1,32 @@
|
||||
@extends('admin::layout')
|
||||
|
||||
@component('admin::components.page.header')
|
||||
@slot('title', trans('$LOWERCASE_MODULE_NAME$::$PLURAL_SNAKE_CASE_ENTITY_NAME$.$PLURAL_SNAKE_CASE_ENTITY_NAME$'))
|
||||
|
||||
<li class="active">{{ trans('$LOWERCASE_MODULE_NAME$::$PLURAL_SNAKE_CASE_ENTITY_NAME$.$PLURAL_SNAKE_CASE_ENTITY_NAME$') }}</li>
|
||||
@endcomponent
|
||||
|
||||
@component('admin::components.page.index_table')
|
||||
@slot('buttons', ['create'])
|
||||
@slot('resource', '$PLURAL_SNAKE_CASE_ENTITY_NAME$')
|
||||
@slot('name', trans('$LOWERCASE_MODULE_NAME$::$PLURAL_SNAKE_CASE_ENTITY_NAME$.$SNAKE_CASE_ENTITY_NAME$'))
|
||||
|
||||
@component('admin::components.table')
|
||||
@slot('thead')
|
||||
<tr>
|
||||
@include('admin::partials.table.select_all')
|
||||
</tr>
|
||||
@endslot
|
||||
@endcomponent
|
||||
@endcomponent
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
new DataTable('#$PLURAL_SNAKE_CASE_ENTITY_NAME$-table .table', {
|
||||
columns: [
|
||||
{ data: 'checkbox', orderable: false, searchable: false, width: '3%' },
|
||||
//
|
||||
],
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
14
app/Scaffold/Module/stubs/views/shortcuts.stub
Normal file
14
app/Scaffold/Module/stubs/views/shortcuts.stub
Normal file
@@ -0,0 +1,14 @@
|
||||
@push('shortcuts')
|
||||
<dl class="dl-horizontal">
|
||||
<dt><code>b</code></dt>
|
||||
<dd>{{ trans('admin::admin.shortcuts.back_to_index', ['name' => trans('$LOWERCASE_MODULE_NAME$::$PLURAL_SNAKE_CASE_ENTITY_NAME$.$SNAKE_CASE_ENTITY_NAME$')]) }}</dd>
|
||||
</dl>
|
||||
@endpush
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
keypressAction([
|
||||
{ key: 'b', route: "{{ route('admin.$PLURAL_SNAKE_CASE_ENTITY_NAME$.index') }}" }
|
||||
]);
|
||||
</script>
|
||||
@endpush
|
||||
Reference in New Issue
Block a user