This page contains general tips and tricks that may be useful during package development.
No doubt, there are no limits to what code you can write, how you structure it and how you name things. However, the last thing you want is to have conflicts with the SeAT core, or someone elses package! The following list contains some tips to help you avoid those conflicts and to help people better discover your packages:
- Prefix your github repository name with
- Tag your github repository with
- Use a unique package namespace such as
- Prefix your database table names with something unique to your package. eg
- Do not modify core tables. This will break future updates for users of your package.
- Prefix your settings with both an author and package eg:
- Prefix redis records with both author and package eg:
- In your
composer.jsonfile, set the
Depending on what your package does, it may be interesting for you to know when data is created / deleted. Given that SeAT makes use of Laravel, you have the ability to subscribe to events that occur on any model within SeAT.
For example, should a
User model get deleted, the
deleted event will get fired. Writing an observer class and subscribing to it with
\Seat\Web\Models\User::observer(\My\Namespace\UserObserver::class) will allow you to define a
deleted() method inside of your observer class and perform extra logic with the
User that got deleted.
Examples of where this may be interesting could be if you need to have cleanup code for tables that your package includes.
For more information, checkout the Laravel documentation on Eloquent Observers.