Skip to content

Commit

Permalink
Laravel 8 support (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardDominik authored Nov 3, 2020
1 parent 949c50a commit 237512c
Show file tree
Hide file tree
Showing 26 changed files with 132 additions and 132 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Admin Generator is a package that helps you quickly scaffold your typical CRUD a
Example of an administration interface generated with this package:
![Craftable administration area example](https://docs.getcraftable.com/assets/posts-crud.png "Craftable administration area example")

This packages is part of [Craftable](https://github.com/BRACKETS-by-TRIAD/craftable) (`brackets/craftable`) - an administration starter kit for Laravel 5. You should definitely have a look :)
This packages is part of [Craftable](https://github.com/BRACKETS-by-TRIAD/craftable) (`brackets/craftable`) - an administration starter kit for Laravel 8. You should definitely have a look :)


## Documentation
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "brackets/admin-generator",
"description": "Laravel 7 CRUD generator for brackets/craftable",
"description": "Laravel 8 CRUD generator for brackets/craftable",
"keywords": [
"generator",
"make",
Expand Down Expand Up @@ -45,16 +45,16 @@
}
],
"require": {
"php": "^7.2.5",
"illuminate/support": "^6.0|^7.0",
"illuminate/console": "^6.0|^7.0",
"php": "^7.2.5|^7.3.0",
"illuminate/support": "^8.0",
"illuminate/console": "^8.0",
"doctrine/dbal": "^2.6.0",
"laravel/helpers": "~1.0"
},
"require-dev": {
"orchestra/testbench": "~4.0|~5.0",
"orchestra/testbench": "~6.0",
"mockery/mockery": "^1.0",
"phpunit/phpunit": "^8.5"
"phpunit/phpunit": "^9.0"
},
"autoload": {
"classmap": [],
Expand All @@ -74,7 +74,7 @@
]
},
"branch-alias": {
"dev-master": "5.0-dev"
"dev-master": "6.0-dev"
}
}
}
2 changes: 1 addition & 1 deletion resources/views/routes.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

/* Auto-generated admin routes */
Route::middleware(['auth:' . config('admin-auth.defaults.guard'), 'admin'])->group(static function () {
Route::prefix('admin')->namespace('Admin')->name('admin/')->group(static function() {
Route::prefix('admin')->namespace('App\Http\Controllers\Admin')->name('admin/')->group(static function() {
Route::prefix('{{ $resource }}')->name('{{ $resource }}/')->group(static function() {
{!! str_pad("Route::get('/',", 60) !!}'{{ $controllerPartiallyFullName }}@index')->name('index');
{!! str_pad("Route::get('/create',", 60) !!}'{{ $controllerPartiallyFullName }}@create')->name('create');
Expand Down
2 changes: 1 addition & 1 deletion resources/views/templates/admin-user/routes.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

/* Auto-generated admin routes */
Route::middleware(['auth:' . config('admin-auth.defaults.guard'), 'admin'])->group(static function () {
Route::prefix('admin')->namespace('Admin')->name('admin/')->group(static function() {
Route::prefix('admin')->namespace('App\Http\Controllers\Admin')->name('admin/')->group(static function() {
Route::prefix('{{ $resource }}')->name('{{ $resource }}/')->group(static function() {
{!! str_pad("Route::get('/',", 60) !!}'{{ $controllerPartiallyFullName }}@index')->name('index');
{!! str_pad("Route::get('/create',", 60) !!}'{{ $controllerPartiallyFullName }}@create')->name('create');
Expand Down
2 changes: 1 addition & 1 deletion resources/views/templates/profile/routes.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

/* Auto-generated admin routes */
Route::middleware(['auth:' . config('admin-auth.defaults.guard'), 'admin'])->group(static function () {
Route::prefix('admin')->namespace('Admin')->name('admin/')->group(static function() {
Route::prefix('admin')->namespace('App\Http\Controllers\Admin')->name('admin/')->group(static function() {
{!! str_pad("Route::get('/profile',", 60) !!}'{{ $controllerPartiallyFullName }}@editProfile')->name('edit-profile');
{!! str_pad("Route::post('/profile',", 60) !!}'{{ $controllerPartiallyFullName }}@updateProfile')->name('update-profile');
{!! str_pad("Route::get('/password',", 60) !!}'{{ $controllerPartiallyFullName }}@editPassword')->name('edit-password');
Expand Down
2 changes: 1 addition & 1 deletion resources/views/templates/user/routes.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

/* Auto-generated admin routes */
Route::middleware(['auth:' . config('admin-auth.defaults.guard'), 'admin'])->group(static function () {
Route::prefix('admin')->namespace('Admin')->name('admin/')->group(static function() {
Route::prefix('admin')->namespace('App\Http\Controllers\Admin')->name('admin/')->group(static function() {
Route::prefix('{{ $resource }}')->name('{{ $resource }}/')->group(static function() {
{!! str_pad("Route::get('/',", 60) !!}'{{ $controllerPartiallyFullName }}@index')->name('index');
{!! str_pad("Route::get('/create',", 60) !!}'{{ $controllerPartiallyFullName }}@create')->name('create');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function admin_user_controller_name_can_be_namespaced(): void
$filePathController = base_path('app/Http/Controllers/Admin/Auth/AdminUsersController.php');
$filePathRoutes = base_path('routes/web.php');

$this->assertFileNotExists($filePathController);
$this->assertFileDoesNotExist($filePathController);

$this->artisan('admin:generate:admin-user', [
'--controller-name' => 'Auth\\AdminUsersController',
Expand Down Expand Up @@ -58,7 +58,7 @@ class AdminUsersController extends Controller', File::get($filePathController));
/* Auto-generated admin routes */
Route::middleware([\'auth:\' . config(\'admin-auth.defaults.guard\'), \'admin\'])->group(static function () {
Route::prefix(\'admin\')->namespace(\'Admin\')->name(\'admin/\')->group(static function() {
Route::prefix(\'admin\')->namespace(\'App\Http\Controllers\Admin\')->name(\'admin/\')->group(static function() {
Route::prefix(\'admin-users\')->name(\'admin-users/\')->group(static function() {
Route::get(\'/\', \'Auth\AdminUsersController@index\')->name(\'index\');
Route::get(\'/create\', \'Auth\AdminUsersController@create\')->name(\'create\');
Expand All @@ -79,7 +79,7 @@ public function admin_user_controller_name_can_be_outside_default_directory(): v
{
$filePath = base_path('app/Http/Controllers/Auth/AdminUsersController.php');

$this->assertFileNotExists($filePath);
$this->assertFileDoesNotExist($filePath);

$this->artisan('admin:generate:admin-user', [
'--controller-name' => 'App\\Http\\Controllers\\Auth\\AdminUsersController',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ public function all_files_should_be_generated_with_custom_model(): void
$formJsPath = resource_path('js/admin/user/Form.js');
$factoryPath = base_path('database/factories/ModelFactory.php');

$this->assertFileNotExists($controllerPath);
$this->assertFileNotExists($storePath);
$this->assertFileNotExists($updatePath);
$this->assertFileNotExists($indexPath);
$this->assertFileNotExists($indexJsPath);
$this->assertFileNotExists($elementsPath);
$this->assertFileNotExists($createPath);
$this->assertFileNotExists($editPath);
$this->assertFileNotExists($formJsPath);
$this->assertFileDoesNotExist($controllerPath);
$this->assertFileDoesNotExist($storePath);
$this->assertFileDoesNotExist($updatePath);
$this->assertFileDoesNotExist($indexPath);
$this->assertFileDoesNotExist($indexJsPath);
$this->assertFileDoesNotExist($elementsPath);
$this->assertFileDoesNotExist($createPath);
$this->assertFileDoesNotExist($editPath);
$this->assertFileDoesNotExist($formJsPath);


$this->artisan('admin:generate:admin-user', [
Expand Down Expand Up @@ -109,7 +109,7 @@ class UpdateUser extends FormRequest
/* Auto-generated admin routes */
Route::middleware([\'auth:\' . config(\'admin-auth.defaults.guard\'), \'admin\'])->group(static function () {
Route::prefix(\'admin\')->namespace(\'Admin\')->name(\'admin/\')->group(static function() {
Route::prefix(\'admin\')->namespace(\'App\Http\Controllers\Admin\')->name(\'admin/\')->group(static function() {
Route::prefix(\'users\')->name(\'users/\')->group(static function() {
Route::get(\'/\', \'Auth\UsersController@index\')->name(\'index\');
Route::get(\'/create\', \'Auth\UsersController@create\')->name(\'create\');
Expand Down
26 changes: 13 additions & 13 deletions tests/Feature/AdminUsers/DefaultAdminUserCrudGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ public function all_files_should_be_generated_under_default_namespace(): void
$formJsPath = resource_path('js/admin/admin-user/Form.js');
$factoryPath = base_path('database/factories/ModelFactory.php');

$this->assertFileNotExists($controllerPath);
$this->assertFileNotExists($indexRequestPath);
$this->assertFileNotExists($storePath);
$this->assertFileNotExists($updatePath);
$this->assertFileNotExists($destroyPath);
$this->assertFileNotExists($indexPath);
$this->assertFileNotExists($listingJsPath);
$this->assertFileNotExists($elementsPath);
$this->assertFileNotExists($createPath);
$this->assertFileNotExists($editPath);
$this->assertFileNotExists($formJsPath);
$this->assertFileNotExists($indexJsPath);
$this->assertFileDoesNotExist($controllerPath);
$this->assertFileDoesNotExist($indexRequestPath);
$this->assertFileDoesNotExist($storePath);
$this->assertFileDoesNotExist($updatePath);
$this->assertFileDoesNotExist($destroyPath);
$this->assertFileDoesNotExist($indexPath);
$this->assertFileDoesNotExist($listingJsPath);
$this->assertFileDoesNotExist($elementsPath);
$this->assertFileDoesNotExist($createPath);
$this->assertFileDoesNotExist($editPath);
$this->assertFileDoesNotExist($formJsPath);
$this->assertFileDoesNotExist($indexJsPath);


$this->artisan('admin:generate:admin-user');
Expand Down Expand Up @@ -132,7 +132,7 @@ class DestroyAdminUser extends FormRequest
/* Auto-generated admin routes */
Route::middleware([\'auth:\' . config(\'admin-auth.defaults.guard\'), \'admin\'])->group(static function () {
Route::prefix(\'admin\')->namespace(\'Admin\')->name(\'admin/\')->group(static function() {
Route::prefix(\'admin\')->namespace(\'App\Http\Controllers\Admin\')->name(\'admin/\')->group(static function() {
Route::prefix(\'admin-users\')->name(\'admin-users/\')->group(static function() {
Route::get(\'/\', \'AdminUsersController@index\')->name(\'index\');
Route::get(\'/create\', \'AdminUsersController@create\')->name(\'create\');
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/Appenders/RoutesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function auto_generated_routes_append(): void
/* Auto-generated admin routes */
Route::middleware([\'auth:\' . config(\'admin-auth.defaults.guard\'), \'admin\'])->group(static function () {
Route::prefix(\'admin\')->namespace(\'Admin\')->name(\'admin/\')->group(static function() {
Route::prefix(\'admin\')->namespace(\'App\Http\Controllers\Admin\')->name(\'admin/\')->group(static function() {
Route::prefix(\'categories\')->name(\'categories/\')->group(static function() {
Route::get(\'/\', \'CategoriesController@index\')->name(\'index\');
Route::get(\'/create\', \'CategoriesController@create\')->name(\'create\');
Expand Down Expand Up @@ -57,7 +57,7 @@ public function custom_model_and_controller_name(): void
/* Auto-generated admin routes */
Route::middleware([\'auth:\' . config(\'admin-auth.defaults.guard\'), \'admin\'])->group(static function () {
Route::prefix(\'admin\')->namespace(\'Admin\')->name(\'admin/\')->group(static function() {
Route::prefix(\'admin\')->namespace(\'App\Http\Controllers\Admin\')->name(\'admin/\')->group(static function() {
Route::prefix(\'billing-categ-ories\')->name(\'billing-categ-ories/\')->group(static function() {
Route::get(\'/\', \'Billing\CategOryController@index\')->name(\'index\');
Route::get(\'/create\', \'Billing\CategOryController@create\')->name(\'create\');
Expand Down
8 changes: 4 additions & 4 deletions tests/Feature/Classes/ControllerNameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function controller_should_be_generated_under_default_namespace(): void
{
$filePath = base_path('app/Http/Controllers/Admin/CategoriesController.php');

$this->assertFileNotExists($filePath);
$this->assertFileDoesNotExist($filePath);

$this->artisan('admin:generate:controller', [
'table_name' => 'categories'
Expand Down Expand Up @@ -52,7 +52,7 @@ public function controller_name_can_be_namespaced(): void
{
$filePath = base_path('app/Http/Controllers/Admin/Billing/MyNameController.php');

$this->assertFileNotExists($filePath);
$this->assertFileDoesNotExist($filePath);

$this->artisan('admin:generate:controller', [
'table_name' => 'categories',
Expand Down Expand Up @@ -90,7 +90,7 @@ public function you_can_generate_controller_outside_default_directory(): void
{
$filePath = base_path('app/Http/Controllers/Billing/CategoriesController.php');

$this->assertFileNotExists($filePath);
$this->assertFileDoesNotExist($filePath);

$this->artisan('admin:generate:controller', [
'table_name' => 'categories',
Expand Down Expand Up @@ -129,7 +129,7 @@ public function you_can_pass_a_model_class_name(): void
{
$filePath = base_path('app/Http/Controllers/Billing/CategoriesController.php');

$this->assertFileNotExists($filePath);
$this->assertFileDoesNotExist($filePath);

$this->artisan('admin:generate:controller', [
'table_name' => 'categories',
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/Classes/DestroyRequestNameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function destroy_request_generation_should_generate_an_update_request_nam
{
$filePath = base_path('app/Http/Requests/Admin/Category/DestroyCategory.php');

$this->assertFileNotExists($filePath);
$this->assertFileDoesNotExist($filePath);

$this->artisan('admin:generate:request:destroy', [
'table_name' => 'categories'
Expand All @@ -37,7 +37,7 @@ public function is_generated_correct_name_for_custom_model_name_in_destroy_reque
{
$filePath = base_path('app/Http/Requests/Admin/Billing/Cat/DestroyCat.php');

$this->assertFileNotExists($filePath);
$this->assertFileDoesNotExist($filePath);

$this->artisan('admin:generate:request:destroy', [
'table_name' => 'categories',
Expand Down
6 changes: 3 additions & 3 deletions tests/Feature/Classes/ModelNameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function model_name_should_auto_generate_from_table_name(): void
{
$filePath = base_path('app/Models/Category.php');

$this->assertFileNotExists($filePath);
$this->assertFileDoesNotExist($filePath);

$this->artisan('admin:generate:model', [
'table_name' => 'categories'
Expand All @@ -36,7 +36,7 @@ public function you_can_pass_custom_class_name_for_the_model(): void
{
$filePath = base_path('app/Models/Billing/Category.php');

$this->assertFileNotExists($filePath);
$this->assertFileDoesNotExist($filePath);

$this->artisan('admin:generate:model', [
'table_name' => 'categories',
Expand All @@ -58,7 +58,7 @@ public function class_name_can_be_outside_default_folder(): void
{
$filePath = base_path('app/Billing/Category.php');

$this->assertFileNotExists($filePath);
$this->assertFileDoesNotExist($filePath);

$this->artisan('admin:generate:model', [
'table_name' => 'categories',
Expand Down
6 changes: 3 additions & 3 deletions tests/Feature/Classes/StoreRequestNameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function store_request_generation_should_generate_a_store_request_name():
{
$filePath = base_path('app/Http/Requests/Admin/Category/StoreCategory.php');

$this->assertFileNotExists($filePath);
$this->assertFileDoesNotExist($filePath);

$this->artisan('admin:generate:request:store', [
'table_name' => 'categories'
Expand All @@ -38,7 +38,7 @@ public function is_generated_correct_name_for_custom_model_name(): void
{
$filePath = base_path('app/Http/Requests/Admin/Billing/Cat/StoreCat.php');

$this->assertFileNotExists($filePath);
$this->assertFileDoesNotExist($filePath);

$this->artisan('admin:generate:request:store', [
'table_name' => 'categories',
Expand All @@ -62,7 +62,7 @@ public function is_generated_correct_name_for_custom_model_name_outside_default_
{
$filePath = base_path('app/Http/Requests/Admin/Cat/StoreCat.php');

$this->assertFileNotExists($filePath);
$this->assertFileDoesNotExist($filePath);

$this->artisan('admin:generate:request:store', [
'table_name' => 'categories',
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/Classes/UpdateRequestNameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function update_request_generation_should_generate_an_update_request_name
{
$filePath = base_path('app/Http/Requests/Admin/Category/UpdateCategory.php');

$this->assertFileNotExists($filePath);
$this->assertFileDoesNotExist($filePath);

$this->artisan('admin:generate:request:update', [
'table_name' => 'categories'
Expand All @@ -38,7 +38,7 @@ public function is_generated_correct_name_for_custom_model_name(): void
{
$filePath = base_path('app/Http/Requests/Admin/Billing/Cat/UpdateCat.php');

$this->assertFileNotExists($filePath);
$this->assertFileDoesNotExist($filePath);

$this->artisan('admin:generate:request:update', [
'table_name' => 'categories',
Expand Down
14 changes: 7 additions & 7 deletions tests/Feature/Profile/DefaultProfileGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ public function all_files_should_be_generated_under_default_namespace(): void
$indexJsPathPassword = resource_path('js/admin/profile-edit-password/index.js');
$bootstrapJsPath = resource_path('js/admin/index.js');

$this->assertFileNotExists($filePathController);
$this->assertFileNotExists($editPathProfile);
$this->assertFileNotExists($formJsPathProfile);
$this->assertFileNotExists($editPathPassword);
$this->assertFileNotExists($formJsPathPassword);
$this->assertFileNotExists($indexJsPathPassword);
$this->assertFileDoesNotExist($filePathController);
$this->assertFileDoesNotExist($editPathProfile);
$this->assertFileDoesNotExist($formJsPathProfile);
$this->assertFileDoesNotExist($editPathPassword);
$this->assertFileDoesNotExist($formJsPathPassword);
$this->assertFileDoesNotExist($indexJsPathPassword);

$this->artisan('admin:generate:admin-user:profile', [
]);
Expand Down Expand Up @@ -61,7 +61,7 @@ class ProfileController extends Controller
/* Auto-generated admin routes */
Route::middleware([\'auth:\' . config(\'admin-auth.defaults.guard\'), \'admin\'])->group(static function () {
Route::prefix(\'admin\')->namespace(\'Admin\')->name(\'admin/\')->group(static function() {
Route::prefix(\'admin\')->namespace(\'App\Http\Controllers\Admin\')->name(\'admin/\')->group(static function() {
Route::get(\'/profile\', \'ProfileController@editProfile\')->name(\'edit-profile\');
Route::post(\'/profile\', \'ProfileController@updateProfile\')->name(\'update-profile\');
Route::get(\'/password\', \'ProfileController@editPassword\')->name(\'edit-password\');
Expand Down
Loading

0 comments on commit 237512c

Please sign in to comment.