Skip to content

Commit cc7f87e

Browse files
committed
#1387: Rename namespaces.
1 parent 9514cee commit cc7f87e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+135
-132
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ All notable changes to `twill` will be documented in this file.
363363
- **Self-contained blocks** (#597) [`1e95b0ac`](https://github.com/area17/twill/commit/1e95b0ac) [`9ae502a4`](https://github.com/area17/twill/commit/9ae502a46ed31f82ebda5426dbff5f56228e2d25) [`948985ef`](https://github.com/area17/twill/commit/948985ef22d70a08287ccdf7583ca802f6182833) [`66fa7c5e`](https://github.com/area17/twill/commit/66fa7c5e16c0ce34f0edc1aab74a52ef0d232401) [`c00759ee`](https://github.com/area17/twill/commit/c00759ee7cad76aea16ec7f04c693ba1cd046b9d)
364364
- This change allows defining blocks without adding them to the `twill.block_editor` configuration
365365
- This is backwards compatible with blocks already defined in configuration
366-
- Repeaters are now created in a dedicated folder: `views/admin/repeaters` by default, but your existing repeaters in the `views/admin/blocks` file will still work
366+
- Repeaters are now created in a dedicated folder: `views/twill/admin/repeaters` by default, but your existing repeaters in the `views/twill/admin/blocks` file will still work
367367
- Annotations are now supported in blocks and repeaters Blade files:
368368
- Provide a title with `@twillPropTitle` or `@twillBlockTitle` or `@twillRepeaterTitle`
369369
- Provide an icon with `@twillPropIcon` or `@twillBlockIcon` or `@twillRepeaterIcon`

config/blocks.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@
6464
'source' => A17\Twill\Services\Blocks\Block::SOURCE_TWILL,
6565
],
6666
[
67-
'path' => resource_path('views/admin/blocks'),
67+
'path' => resource_path('views/twill/admin/blocks'),
6868
'source' => A17\Twill\Services\Blocks\Block::SOURCE_APP,
6969
],
7070
],
7171

7272
'repeaters' => [
7373
[
74-
'path' => resource_path('views/admin/repeaters'),
74+
'path' => resource_path('views/twill/admin/repeaters'),
7575
'source' => A17\Twill\Services\Blocks\Block::SOURCE_APP,
7676
],
7777
[
@@ -82,16 +82,16 @@
8282

8383
'icons' => [
8484
base_path('vendor/area17/twill/frontend/icons'),
85-
resource_path('views/admin/icons'),
85+
resource_path('views/twill/admin/icons'),
8686
],
8787
],
8888

8989
'destination' => [
9090
'make_dir' => true,
9191

92-
'blocks' => resource_path('views/admin/blocks'),
92+
'blocks' => resource_path('views/twill/admin/blocks'),
9393

94-
'repeaters' => resource_path('views/admin/repeaters'),
94+
'repeaters' => resource_path('views/twill/admin/repeaters'),
9595
],
9696
],
9797
];

config/capsules.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
// '/app-dir/vendor/area17/twill/vendor/orchestra/testbench-core/laravel/app/Twill/Capsules/Posts/resources/views',
5858
// 'view_prefix' => 'Posts.resources.views.admin',
5959
// 'routes_file' =>
60-
// '/app-dir/vendor/area17/twill/vendor/orchestra/testbench-core/laravel/app/Twill/Capsules/Posts/routes/admin.php',
60+
// '/app-dir/vendor/area17/twill/vendor/orchestra/testbench-core/laravel/app/Twill/Capsules/Posts/routes/twill.php',
6161
// 'models_dir' =>
6262
// '/app-dir/vendor/area17/twill/vendor/orchestra/testbench-core/laravel/app/Twill/Capsules/Posts/app/Data/Models',
6363
// 'translation' =>

docs/src/block-editor/adding-browser-fields-to-a-block.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ To attach other records inside of a block, it is possible to use the `browser` f
88

99
- In a block, use the `browser` field:
1010

11-
filename: ```views/admin/blocks/products.blade.php```
11+
filename: ```views/twill/admin/blocks/products.blade.php```
1212
```php
1313
@twillBlockTitle('Products')
1414

docs/src/block-editor/adding-repeater-fields-to-a-block.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ Inside a block, repeaters can be used too.
88

99
- Create a *container* block file, using a repeater form field:
1010

11-
filename: ```views/admin/blocks/accordion.blade.php```
11+
filename: ```views/twill/admin/blocks/accordion.blade.php```
1212
```php
1313
@twillBlockTitle('Accordion')
1414
...
1515
@formField('repeater', ['type' => 'accordion_item'])
1616
```
1717
You can add other fields before or after your repeater, or even multiple repeaters to the same block.
1818

19-
- Create an *item* block, the one that will be reapeated inside the *container* block
19+
- Create an *item* block, the one that will be repeated inside the *container* block
2020

21-
filename: ```views/admin/repeaters/accordion_item.blade.php```
21+
filename: ```views/twill/admin/repeaters/accordion_item.blade.php```
2222
```php
2323
@twillRepeaterTitle('Accordion item')
2424
@twillRepeaterMax('10')

docs/src/block-editor/creating-a-block-editor.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ By default, adding the `@formField('block_editor')` directive enables all availa
3131

3232
#### Create and define blocks
3333

34-
Blocks and Repeaters are built on the same Block model and are created and defined in their respective folders. By default, Twill will look for Blade templates in `views/admin/blocks` for blocks and `views/admin/repeaters` for repeaters.
34+
Blocks and Repeaters are built on the same Block model and are created and defined in their respective folders. By default, Twill will look for Blade templates in `views/twill/admin/blocks` for blocks and `views/twill/admin/repeaters` for repeaters.
3535

3636
Note: Prior to Twill version 2.2, Blocks (and Repeaters) needed to be defined in the configuration file – this is no longer necessary and not recommended. This change is backward compatible, so your existing configuration should work as it used to. Defining blocks in the configuration file will be deprecated in a future release (see the section below [Legacy configuration](/block-editor/legacy-configuration-2-2.html).
3737

@@ -49,7 +49,7 @@ Available annotations:
4949

5050
e.g.:
5151

52-
filename: ```views/admin/blocks/quote.blade.php```
52+
filename: ```views/twill/admin/blocks/quote.blade.php```
5353
```php
5454
@twillBlockTitle('Quote')
5555
@twillBlockIcon('text')
@@ -65,7 +65,7 @@ filename: ```views/admin/blocks/quote.blade.php```
6565

6666
A more complex example would look like this:
6767

68-
filename: ```views/admin/blocks/media.blade.php```
68+
filename: ```views/twill/admin/blocks/media.blade.php```
6969
```php
7070
@twillBlockTitle('Media')
7171
@twillBlockIcon('image')
@@ -147,7 +147,7 @@ In Twill >= 2.5, you can use the `@twillBlockTitleField` directive to include th
147147

148148
Using `php artisan twill:make:block {name} {baseBlock} {icon}`, you can generate a new block based on a provided block as a base.
149149

150-
This example would create `views/admin/blocks/exceptional-media.blade.php` from `views/admin/blocks/media.blade.php`:
150+
This example would create `views/twill/admin/blocks/exceptional-media.blade.php` from `views/twill/admin/blocks/media.blade.php`:
151151

152152
```
153153
$ php artisan twill:make:block ExceptionalMedia media image

docs/src/block-editor/default-configuration.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ return [
6767
'source' => A17\Twill\Services\Blocks\Block::SOURCE_TWILL,
6868
],
6969
[
70-
'path' => resource_path('views/admin/blocks'),
70+
'path' => resource_path('views/twill/admin/blocks'),
7171
'source' => A17\Twill\Services\Blocks\Block::SOURCE_APP,
7272
],
7373
],
7474
'repeaters' => [
7575
[
76-
'path' => resource_path('views/admin/repeaters'),
76+
'path' => resource_path('views/twill/admin/repeaters'),
7777
'source' => A17\Twill\Services\Blocks\Block::SOURCE_APP,
7878
],
7979
[
@@ -83,13 +83,13 @@ return [
8383
],
8484
'icons' => [
8585
base_path('vendor/area17/twill/frontend/icons'),
86-
resource_path('views/admin/icons'),
86+
resource_path('views/twill/admin/icons'),
8787
],
8888
],
8989
'destination' => [
9090
'make_dir' => true,
91-
'blocks' => resource_path('views/admin/blocks'),
92-
'repeaters' => resource_path('views/admin/repeaters'),
91+
'blocks' => resource_path('views/twill/admin/blocks'),
92+
'repeaters' => resource_path('views/twill/admin/repeaters'),
9393
],
9494
],
9595
];

docs/src/crud-modules/cli-generator.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The command accepts several options:
2222

2323
The `twill:module` command will generate a migration file, a model, a repository, a controller, a form request object and a form view.
2424

25-
Add the route to your admin routes file(`routes/admin.php`).
25+
Add the route to your admin routes file(`routes/twill.php`).
2626

2727
```php
2828
<?php
@@ -73,7 +73,7 @@ The functionalities are exactly the same as that of regular modules. But they ar
7373

7474
After generating your singleton via the command mentioned above:
7575

76-
Add the route to your admin routes file(`routes/admin.php`).
76+
Add the route to your admin routes file(`routes/twill.php`).
7777

7878
```php
7979
<?php

docs/src/crud-modules/controllers.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ in `A17\Twill\Http\Controllers\Admin\ModuleController`.
161161

162162
Let's say we have a controller with certain fields displayed:
163163

164-
File: `app/Http/Controllers/Admin/PlayController.php`
164+
File: `app/Http/Controllers/Twill/PlayController.php`
165165

166166
```php
167167
protected $indexColumns = [
@@ -222,7 +222,7 @@ File: `app/Models/Play.php`
222222

223223
You can override the `additionalTableActions()` method to add custom actions in your module's listing view:
224224

225-
File: `app/Http/Controllers/Admin/NewsletterController.php`
225+
File: `app/Http/Controllers/Twill/NewsletterController.php`
226226

227227
```php
228228
public function additionalTableActions()

docs/src/crud-modules/form-requests.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pageClass: twill-doc
66

77
Classic Laravel 5 [form request validation](https://laravel.com/docs/5.5/validation#form-request-validation).
88

9-
Once you generated the module using Twill's CLI module generator, it will also prepare the `App/Http/Requests/Admin/ModuleNameRequest.php` for you to use.
9+
Once you generated the module using Twill's CLI module generator, it will also prepare the `App/Http/Requests/Twill/ModuleNameRequest.php` for you to use.
1010
You can choose to use different rules for creation and update by implementing the following 2 functions instead of the classic `rules` one:
1111

1212
```php

docs/src/crud-modules/nested-modules.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ class IssueController extends BaseModuleController
191191
}
192192
```
193193

194-
Add both modules to `routes/admin.php`:
194+
Add both modules to `routes/twill.php`:
195195

196196
```php
197197
Route::module('issues');
@@ -211,7 +211,7 @@ return [
211211

212212
Then, rename and move the `articles/` views folder inside of the parent `issues/` folder:
213213
```
214-
resources/views/admin/
214+
resources/views/twill/admin/
215215
└── issues
216216
├── articles
217217
│ └── form.blade.php

docs/src/custom-cms-pages/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Twill includes the ability to create fully custom pages that includes your navig
88

99
#### Example
1010

11-
- Create a route in `routes/admin.php`
11+
- Create a route in `routes/twill.php`
1212

1313
```php
1414
Route::name('customPage')->get('/customPage', 'MockController@show');

docs/src/form-fields/browser.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class ArticleRepository extends ModuleRepository
6565
}
6666
```
6767

68-
- Add the browser field to `resources/views/admin/articles/form.blade.php`:
68+
- Add the browser field to `resources/views/twill/admin/articles/form.blade.php`:
6969

7070
```php
7171
@extends('twill::layouts.form')
@@ -95,7 +95,7 @@ class ArticleRepository extends ModuleRepository
9595
}
9696
```
9797

98-
- Add the browser field to `resources/views/admin/articles/form.blade.php`:
98+
- Add the browser field to `resources/views/twill/admin/articles/form.blade.php`:
9999

100100
```php
101101
@extends('twill::layouts.form')

docs/src/form-fields/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pageClass: twill-doc
44

55
# Form Fields
66

7-
Your module `form` view should look something like this (`resources/views/admin/moduleName/form.blade.php`):
7+
Your module `form` view should look something like this (`resources/views/twill/admin/moduleName/form.blade.php`):
88

99
```php
1010
@extends('twill::layouts.form')

docs/src/form-fields/repeater.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class TeamRepository extends ModuleRepository
110110

111111
- Add the repeater Blade template:
112112

113-
Create file `resources/views/admin/repeaters/team-member.blade.php`:
113+
Create file `resources/views/twill/admin/repeaters/team-member.blade.php`:
114114

115115
```php
116116
@twillRepeaterTitle('Team Member')
@@ -128,7 +128,7 @@ Create file `resources/views/admin/repeaters/team-member.blade.php`:
128128

129129
- Add the repeater field to the form:
130130

131-
Update file `resources/views/admin/teams/form.blade.php`:
131+
Update file `resources/views/twill/admin/teams/form.blade.php`:
132132

133133
```php
134134
@extends('twill::layouts.form')
@@ -142,7 +142,7 @@ Update file `resources/views/admin/teams/form.blade.php`:
142142

143143
- Finishing up:
144144

145-
Add both modules to your `admin.php` routes. Add the `Team` module to your `twill-navigation.php` config and you are done!
145+
Add both modules to your `twill.php` routes. Add the `Team` module to your `twill-navigation.php` config and you are done!
146146

147147
## Dynamic repeater titles
148148

docs/src/getting-started/installation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Make sure to setup your .env file with your database credentials and to run it w
2727
:::
2828

2929
Twill's `install` command consists of:
30-
- creating an `admin.php` routes files in your application's `routes` directory. This is where you will declare your own admin console routes.
30+
- creating an `twill.php` routes files in your application's `routes` directory. This is where you will declare your own admin console routes.
3131
- migrating your database with Twill's migrations.
3232
- publishing Twill's configuration files to your application's `config` directory.
3333
- publishing Twill's assets for the admin console UI.

docs/src/settings-sections/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Start by enabling the `settings` feature in your `config/twill.php` configuratio
1010

1111
If you did not enable this feature before running the `twill:install` command, you need to copy the migration in `vendor/area17/twill/migrations/create_settings_table.php` to your own `database/migrations` directory and migrate your database before continuing.
1212

13-
To create a new settings section, add a blade file to your `resources/views/admin/settings` folder. The name of this file is the name of your new settings section.
13+
To create a new settings section, add a blade file to your `resources/views/twill/admin/settings` folder. The name of this file is the name of your new settings section.
1414

1515
In this file, you can use `@formField('input')` Blade directives to add new settings. The name attribute of each form field is the name of a setting. Wrap them like in the following example:
1616

@@ -49,7 +49,7 @@ return [
4949
];
5050
```
5151

52-
Each Blade file you create in `resources/views/admin/settings` creates a new section available for you to add in the `primary_navigation` array of your `config/twill-navigation.php` file.
52+
Each Blade file you create in `resources/views/twill/admin/settings` creates a new section available for you to add in the `primary_navigation` array of your `config/twill-navigation.php` file.
5353

5454
You can then retrieve the value of a specific setting by its key, which is the name of the form field you defined in your settings form, either by directly using the `A17\Twill\Models\Setting` Eloquent model or by using the provided `byKey` helper in `A17\Twill\Repositories\SettingRepository`:
5555

src/Commands/GenerateBlocks.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function __construct(Filesystem $filesystem, ViewFactory $viewFactory)
5858
*/
5959
public function handle()
6060
{
61-
if (!$this->filesystem->exists($path = resource_path('views/admin/blocks'))) {
61+
if (!$this->filesystem->exists($path = resource_path('views/twill/admin/blocks'))) {
6262
$this->error(self::NO_BLOCKS_DEFINED);
6363

6464
return;

src/Commands/Install.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function handle()
6868
}
6969

7070
/**
71-
* Creates the default `admin.php` route configuration file.
71+
* Creates the default `twill.php` route configuration file.
7272
*
7373
* @return void
7474
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
@@ -81,9 +81,9 @@ private function addRoutesFile()
8181
$this->files->makeDirectory($routesPath, 0755, true);
8282
}
8383

84-
if (!$this->files->exists($routesPath . '/admin.php')) {
84+
if (!$this->files->exists($routesPath . '/twill.php')) {
8585
$stub = $this->files->get(__DIR__ . '/stubs/admin.stub');
86-
$this->files->put($routesPath . '/admin.php', $stub);
86+
$this->files->put($routesPath . '/twill.php', $stub);
8787
}
8888
}
8989

src/Commands/ModuleMake.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,10 @@ public function handle()
254254
$this->createCapsuleSeed($moduleName);
255255
} elseif ($this->isSingleton) {
256256
$this->createSingletonSeed($modelName);
257-
$this->info("\nAdd to routes/admin.php:\n");
257+
$this->info("\nAdd to routes/twill.php:\n");
258258
$this->info(" Route::singleton('{$singularModuleName}');\n");
259259
} else {
260-
$this->info("\nAdd to routes/admin.php:\n");
260+
$this->info("\nAdd to routes/twill.php:\n");
261261
$this->info(" Route::module('{$moduleName}');\n");
262262
}
263263

@@ -523,7 +523,7 @@ private function createController($moduleName = 'items', $modelName = 'Item')
523523
{
524524
$controllerClassName = $modelName . 'Controller';
525525

526-
$dir = $this->isCapsule ? $this->capsule['controllers_dir'] : 'Http/Controllers/Admin';
526+
$dir = $this->isCapsule ? $this->capsule['controllers_dir'] : 'Http/Controllers/Twill';
527527

528528
if ($this->isSingleton) {
529529
$baseController = config('twill.base_singleton_controller');
@@ -537,7 +537,7 @@ private function createController($moduleName = 'items', $modelName = 'Item')
537537

538538
$stub = str_replace(
539539
['{{moduleName}}', '{{controllerClassName}}', '{{namespace}}', '{{baseController}}'],
540-
[$moduleName, $controllerClassName, $this->namespace('controllers', 'Http\Controllers\Admin'), $baseController],
540+
[$moduleName, $controllerClassName, $this->namespace('controllers', 'Http\Controllers\Twill'), $baseController],
541541
$this->files->get(__DIR__ . '/stubs/controller.stub')
542542
);
543543

@@ -579,15 +579,15 @@ private function createController($moduleName = 'items', $modelName = 'Item')
579579
*/
580580
private function createRequest($modelName = 'Item')
581581
{
582-
$dir = $this->isCapsule ? $this->capsule['requests_dir'] : 'Http/Requests/Admin';
582+
$dir = $this->isCapsule ? $this->capsule['requests_dir'] : 'Http/Requests/Twill';
583583

584584
$this->makeTwillDirectory($dir);
585585

586586
$requestClassName = $modelName . 'Request';
587587

588588
$stub = str_replace(
589589
['{{requestClassName}}', '{{namespace}}', '{{baseRequest}}'],
590-
[$requestClassName, $this->namespace('requests', 'Http\Requests\Admin'), config('twill.base_request')],
590+
[$requestClassName, $this->namespace('requests', 'Http\Requests\Twill'), config('twill.base_request')],
591591
$this->files->get(__DIR__ . '/stubs/request.stub')
592592
);
593593

@@ -790,7 +790,7 @@ public function namespace ($type, $suffix, $class = null) {
790790
public function viewPath($moduleName)
791791
{
792792
if (!$this->isCapsule) {
793-
return $viewsPath = $this->config->get('view.paths')[0] . '/admin/' . $moduleName;
793+
return $viewsPath = $this->config->get('view.paths')[0] . '/twill/admin/' . $moduleName;
794794
}
795795

796796
$this->makeDir($dir = "{$this->moduleBasePath}/resources/views/admin");

0 commit comments

Comments
 (0)