added tests
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user