added tests

This commit is contained in:
Jake Mitchell
2016-06-25 22:10:21 +00:00
parent ea3ec0bacc
commit ddea4dd573
5 changed files with 47 additions and 12 deletions

View File

@@ -71,24 +71,22 @@ class CreatePostsTable extends Migration
}
```
Then, when you create a new model, a Post in this case, your function would look something like this:
Then, just create a model like usual:
``` php
public function createPost () {
$post = Post::create([
// post data
]);
$post->setUuid();
}
```
You now have access to a universal identifier for every model in the entire project.
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:
``` php
$post->hasUuid(); // returns true or false
$post->getUuid(); // returns the UUID if it exists, else null
$post->getUuid(); // returns the UUID
```
The other big feature of the Meta model is saving meta information.