Skip to content

Commit e6be8cf

Browse files
authored
Merge pull request #47 from nafiesl/laravel_9_support
Laravel 9 support
2 parents 8b9d4ac + 30840f6 commit e6be8cf

18 files changed

Lines changed: 1254 additions & 1011 deletions

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
}
2121
},
2222
"require": {
23-
"php": "^7.3|^8.0",
24-
"illuminate/support": "^8.0",
25-
"laravel/browser-kit-testing": "^6.0"
23+
"php": "^8.0",
24+
"illuminate/support": "^9.0",
25+
"laravel/browser-kit-testing": "^6.3"
2626
},
2727
"require-dev": {
28-
"orchestra/testbench": "^6.0"
28+
"orchestra/testbench": "^7.0"
2929
},
3030
"extra": {
3131
"laravel": {

composer.lock

Lines changed: 1143 additions & 982 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Generators/FormRequestGenerator.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ public function generate(string $type = 'full')
2020

2121
$requestPath = $this->makeDirectory(app_path('Http/Requests/'.$pluralModelName));
2222

23-
$this->generateFile(
24-
$requestPath.'/CreateRequest.php', $this->getContent('requests/create-request')
25-
);
23+
if ($this->command->option('uuid')) {
24+
$this->generateFile($requestPath.'/CreateRequest.php', $this->getContent('requests/create-request-uuid'));
25+
} else {
26+
$this->generateFile($requestPath.'/CreateRequest.php', $this->getContent('requests/create-request'));
27+
}
2628
$this->generateFile(
2729
$requestPath.'/UpdateRequest.php', $this->getContent('requests/update-request')
2830
);

src/Generators/LangFileGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class LangFileGenerator extends BaseGenerator
1515
public function generate(string $type = 'full')
1616
{
1717
$locale = config('app.locale');
18-
$langPath = $this->makeDirectory(resource_path('lang/'.$locale));
18+
$langPath = $this->makeDirectory(base_path('lang/'.$locale));
1919

2020
$this->createAppLangFile($langPath);
2121

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace App\Http\Requests\Masters;
4+
5+
use fullMstr;
6+
use Illuminate\Foundation\Http\FormRequest;
7+
use Illuminate\Support\Str;
8+
9+
class CreateRequest extends FormRequest
10+
{
11+
public function authorize()
12+
{
13+
return $this->user()->can('create', new Master);
14+
}
15+
16+
public function rules()
17+
{
18+
return [
19+
'title' => 'required|max:60',
20+
'description' => 'nullable|max:255',
21+
];
22+
}
23+
24+
public function save()
25+
{
26+
$newMaster = $this->validated();
27+
$newMaster['id'] = Str::uuid();
28+
$newMaster['creator_id'] = auth()->id();
29+
30+
return Master::create($newMaster);
31+
}
32+
}

tests/CommandOptions/FullCrudBs3OptionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function it_can_generate_views_with_bootstrap3_for_full_crud()
2626
$this->assertFileDoesNotExist(resource_path("views/{$this->table_name}/forms.blade.php"));
2727

2828
$localeConfig = config('app.locale');
29-
$this->assertFileExists(resource_path("lang/{$localeConfig}/{$this->lang_name}.php"));
29+
$this->assertFileExists(base_path("lang/{$localeConfig}/{$this->lang_name}.php"));
3030

3131
$this->assertFileExists(base_path("routes/web.php"));
3232
$this->assertFileExists(app_path("Policies/{$this->model_name}Policy.php"));

tests/CommandOptions/FullCrudFormRequestOptionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function it_can_generate_form_request_classes()
2828
$this->assertFileDoesNotExist(resource_path("views/{$this->table_name}/forms.blade.php"));
2929

3030
$localeConfig = config('app.locale');
31-
$this->assertFileExists(resource_path("lang/{$localeConfig}/{$this->lang_name}.php"));
31+
$this->assertFileExists(base_path("lang/{$localeConfig}/{$this->lang_name}.php"));
3232

3333
$this->assertFileExists(base_path("routes/web.php"));
3434
$this->assertFileExists(app_path("Policies/{$this->model_name}Policy.php"));

tests/CommandOptions/FullCrudFormfieldBs3OptionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function it_can_generate_views_with_formfield_and_bootstrap3_for_full_cru
2626
$this->assertFileDoesNotExist(resource_path("views/{$this->table_name}/forms.blade.php"));
2727

2828
$localeConfig = config('app.locale');
29-
$this->assertFileExists(resource_path("lang/{$localeConfig}/{$this->lang_name}.php"));
29+
$this->assertFileExists(base_path("lang/{$localeConfig}/{$this->lang_name}.php"));
3030

3131
$this->assertFileExists(base_path("routes/web.php"));
3232
$this->assertFileExists(app_path("Policies/{$this->model_name}Policy.php"));

tests/CommandOptions/FullCrudFormfieldOptionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function it_can_generate_views_with_formfield_for_full_crud()
2626
$this->assertFileDoesNotExist(resource_path("views/{$this->table_name}/forms.blade.php"));
2727

2828
$localeConfig = config('app.locale');
29-
$this->assertFileExists(resource_path("lang/{$localeConfig}/{$this->lang_name}.php"));
29+
$this->assertFileExists(base_path("lang/{$localeConfig}/{$this->lang_name}.php"));
3030

3131
$this->assertFileExists(base_path("routes/web.php"));
3232
$this->assertFileExists(app_path("Policies/{$this->model_name}Policy.php"));

tests/CommandOptions/SimpleCrudBs3OptionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function it_can_generate_views_with_bootstrap3_for_simple_crud()
2424
$this->assertFileExists(resource_path("views/{$this->table_name}/forms.blade.php"));
2525

2626
$localeConfig = config('app.locale');
27-
$this->assertFileExists(resource_path("lang/{$localeConfig}/{$this->lang_name}.php"));
27+
$this->assertFileExists(base_path("lang/{$localeConfig}/{$this->lang_name}.php"));
2828

2929
$this->assertFileExists(base_path("routes/web.php"));
3030
$this->assertFileExists(app_path("Policies/{$this->model_name}Policy.php"));

0 commit comments

Comments
 (0)