updated README and PHPDocs; cleaned up code

master
Garrett Mills 7 years ago
parent 95f5ba11df
commit d2062d244e

@ -49,14 +49,14 @@ class Post extends Meta
The Meta plugin adds a custom Artisan command to auto-generate migrations for meta-enabled models.
To generate a migration for a new meta-model, use the following command:
```
php artisan meta:migration name_of_migration --create=table_name
``` bash
$ php artisan meta:migration name_of_migration --create=table_name
```
Add your custom fields, if any, then migrate as usual:
```
php artisan migrate
``` bash
$ php artisan migrate
```
Then, just create a model like usual:
@ -69,6 +69,8 @@ public function createPost () {
}
```
(The `meta:migration` command extends the `make:migration`, so it contains all of the original functionality.)
But now, you have access to a universal identifier for every model in the entire project.
You can check if a model has a UUID, and get it if it does:
@ -98,8 +100,8 @@ To add Meta capabilities to existing models, you need to add the database column
Create a new database migration using the custom Meta command:
```
php artisan meta:migration --table=existing_table_name
``` bash
$ php artisan meta:migration --table=existing_table_name
```
Make sure the inside of the `up()` function matches the following:
@ -115,8 +117,8 @@ public function up()
Then, migrate:
```
php artisan migrate
``` bash
$ php artisan migrate
```
##### Model Class updates

@ -14,13 +14,14 @@ class MetaServiceProvider extends ServiceProvider
*/
protected $defer = false;
/**
* Register the custom Artisan commands.
*/
protected $commands = [
'\Glmdev\Meta\Commands\MetaMigrationCommand',
];
public function boot(){
}
public function boot(){}
/**
* Register any package services.
@ -29,16 +30,11 @@ class MetaServiceProvider extends ServiceProvider
*/
public function register()
{
// die('gtest2');
// alias the Meta class for easy access
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
$loader->alias('Meta', 'Glmdev\Meta\Meta');
// register the Artisan commands
$this->commands($this->commands);
}
public static function hello(){return "Hello!";}
}

Loading…
Cancel
Save