Created
January 12, 2022 10:26
-
-
Save dominiquevienne/5e0f060b6416e903cc4a65d19691549e to your computer and use it in GitHub Desktop.
Test basic BlogPost model functionalities using Laravel Tinker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> $bp = new BlogPost; | |
=> App\Models\BlogPost {#4238} | |
>>> $bp->title = 'My title'; | |
=> "My title" | |
>>> $bp->content = 'Some content long content'; | |
=> "Some content long content" | |
>>> $bp->author_name = 'My Name'; | |
=> "My Name" | |
>>> $bp->save(); | |
=> true | |
>>> $bp->all(); | |
=> Illuminate\Database\Eloquent\Collection {#3833 | |
all: [ | |
App\Models\BlogPost {#4201 | |
id: 1, | |
title: "My title", | |
content: "Some content long content", | |
author_name: "My Name", | |
created_at: "2022-01-11 15:13:43", | |
updated_at: "2022-01-11 15:13:43", | |
}, | |
], | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment