Skip to content

Instantly share code, notes, and snippets.

@dominiquevienne
Created January 12, 2022 10:26
Show Gist options
  • Save dominiquevienne/5e0f060b6416e903cc4a65d19691549e to your computer and use it in GitHub Desktop.
Save dominiquevienne/5e0f060b6416e903cc4a65d19691549e to your computer and use it in GitHub Desktop.
Test basic BlogPost model functionalities using Laravel Tinker
>>> $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