Skip to content

Commit f35d95e

Browse files
committed
Update examples
1 parent 3a933fd commit f35d95e

File tree

1 file changed

+26
-24
lines changed

1 file changed

+26
-24
lines changed

docs/developers/addons.md

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,21 @@ the module, if you want to make it available on composer, edit the
2828

2929
:::tip
3030

31-
All of the examples below will be based on a module named `Sample`. To
32-
see the source for the module,
31+
All of the examples below will be based on a module named `Sample`. To see the
32+
source for the module,
3333
[check it out on GitHub](https://github.com/nabeelio/phpvms-module).
3434

3535
:::
3636

3737
:::tip
3838

39-
When naming your module, it is recommended that if your module name runs the risk of being generic, to prefix your module name with a unique identifier. For example, instead of naming your module `Tours`, name it `XXTours` (The XX in the example being the identifier or brand name you choose)
39+
When naming your module, it is recommended that if your module name runs the
40+
risk of being generic, to prefix your module name with a unique identifier. For
41+
example, instead of naming your module `Tours`, name it `XXTours` (The XX in the
42+
example being the identifier or brand name you choose)
4043

41-
In doing this, you reduce the chance of your module name conflicting directly with another module.
44+
In doing this, you reduce the chance of your module name conflicting directly
45+
with another module.
4246

4347
:::
4448

@@ -152,8 +156,7 @@ don't need to call a check or something in every method.
152156

153157
:::note
154158

155-
Read more about
156-
[Laravel Middleware](https://laravel.com/docs/9.x/middleware)
159+
Read more about [Laravel Middleware](https://laravel.com/docs/9.x/middleware)
157160

158161
:::
159162

@@ -205,8 +208,6 @@ if(Auth::check())
205208

206209
# Database Access
207210

208-
209-
210211
## Models
211212

212213
Models are the more basic way to access your database tables. For example, if
@@ -294,32 +295,33 @@ straight-forward, without having to run any SQL manually.
294295
The `app/Database/migrations` directory has the core migrations and is a good
295296
reference on field types, especially if you're looking to add relationships.
296297

297-
:::note
298-
299-
Design your tables well - follow the guidelines set by Laravel, and you'll
298+
**Design your tables well** - follow the guidelines set by Laravel, and you'll
300299
have a much better time.
301300

302-
:::
303-
304-
305301
:::note
306302

307-
Add new migration files when you have to modify a table, etc, after you've
303+
Add new migration files when you have to modify a table, etc., after you've
308304
released it into the wild. The migrations that are run are kept track of, so if
309305
it's seen that it's already run the file, it won't run it again.
310306

311307
:::
312308

313-
:::warning[Table Name Convention]
309+
### Table Name Convention
314310

315-
When naming tables, table names *should* be prefixed with a short indentifier that is unqiue to your addon or group of addons (e.g. `disposable_`, `ch_`, `sp_`, etc.). For example, instead of naming a table `tours`, name it `ch_tours`. This includes pivot tables. See Laravel documentation on how to override the default conventions for table names, foreign relationships, etc. where required.
311+
When naming tables, table names _should_ be prefixed with a short indentifier
312+
that is unqiue to your addon or group of addons (e.g. `disposable_`, `ch_`,
313+
`sp_`, etc.). For example, instead of naming a table `tours`, name it
314+
`ch_tours`. This includes pivot tables. See Laravel documentation on how to
315+
override the default conventions for table names, foreign relationships, etc.
316+
where required.
316317

317-
Not prefixing your tables could lead to unintended consequences, including but not limited to:
318+
**Not prefixing your tables could lead to unintended consequences**, including
319+
but not limited to:
318320

319-
* Conflicting with future phpVMS core features that would use the same table name, thereby making it more difficult to update phpVMS at a later date.
320-
* Conflicting with other addons by other 3rd party modules that don't head this warning.
321-
322-
:::
321+
- Conflicting with future phpVMS core features that would use the same table
322+
name, thereby making it more difficult to update phpVMS at a later date.
323+
- Conflicting with other addons by other 3rd party modules that don't head this
324+
warning.
323325

324326
### Seeding Data
325327

@@ -341,7 +343,7 @@ class CreateSettingsTable extends Migration
341343
*/
342344
public function up()
343345
{
344-
Schema::create('settings', function (Blueprint $table) {
346+
Schema::create('myaddon_settings', function (Blueprint $table) {
345347
// ... Create all the columns
346348
});
347349

@@ -360,7 +362,7 @@ class CreateSettingsTable extends Migration
360362

361363
];
362364

363-
$this->addData('settings', $settings);
365+
$this->addData('myaddon_settings', $settings);
364366
}
365367

366368
// Not showning the down()

0 commit comments

Comments
 (0)