anekdotes / staticmodel
Abstract class used to create static Model classes. These classes have their data initiated in themselves. Allows Model operations to be used to a certain extent.
2.0.0
2021-11-24 15:45 UTC
Requires
- php: >=7.4.0
- anekdotes/support: *
Requires (Dev)
- phpunit/phpunit: ^9
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Abstract class used to create static Model classes. These classes have their data initiated in themselves. Allows Model operations to be used to a certain extent.
Installation
Install via composer into your project:
composer require anekdotes/staticmodel
Usage
Create your static class by inheriting StaticModel. Fill it with your static data.
class Languages extends StaticModel { public static $data = array( array( 'id' => 1, 'name' => 'English', 'small' => 'en' ) ); }
You can then call the model as any other Illuminate model, and use most of Illuminate's functionalities.
$english = Languages::find(1); $englishname = $english->name;