You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/developers/addons.md
+26-24Lines changed: 26 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -28,17 +28,21 @@ the module, if you want to make it available on composer, edit the
28
28
29
29
:::tip
30
30
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,
33
33
[check it out on GitHub](https://github.com/nabeelio/phpvms-module).
34
34
35
35
:::
36
36
37
37
:::tip
38
38
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)
40
43
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.
42
46
43
47
:::
44
48
@@ -152,8 +156,7 @@ don't need to call a check or something in every method.
Read more about [Laravel Middleware](https://laravel.com/docs/9.x/middleware)
157
160
158
161
:::
159
162
@@ -205,8 +208,6 @@ if(Auth::check())
205
208
206
209
# Database Access
207
210
208
-
209
-
210
211
## Models
211
212
212
213
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.
294
295
The `app/Database/migrations` directory has the core migrations and is a good
295
296
reference on field types, especially if you're looking to add relationships.
296
297
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
300
299
have a much better time.
301
300
302
-
:::
303
-
304
-
305
301
:::note
306
302
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
308
304
released it into the wild. The migrations that are run are kept track of, so if
309
305
it's seen that it's already run the file, it won't run it again.
310
306
311
307
:::
312
308
313
-
:::warning[Table Name Convention]
309
+
### Table Name Convention
314
310
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.
316
317
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:
318
320
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.
323
325
324
326
### Seeding Data
325
327
@@ -341,7 +343,7 @@ class CreateSettingsTable extends Migration
341
343
*/
342
344
public function up()
343
345
{
344
-
Schema::create('settings', function (Blueprint $table) {
346
+
Schema::create('myaddon_settings', function (Blueprint $table) {
345
347
// ... Create all the columns
346
348
});
347
349
@@ -360,7 +362,7 @@ class CreateSettingsTable extends Migration
0 commit comments