This file contains hidden or 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
| $post = Post::find(1); | |
| $post->comments()->saveMany([ | |
| new Comment(['message' => 'First comment']), | |
| new Comment(['message' => 'Second comment']), | |
| ]); | |
This file contains hidden or 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
| //view_countใไธใคใซใฆใณใใใฆใณใใ | |
| Post::find($post_id)->decreament('view_count'); | |
| //ใใคใณใใ50ๆธ็ฎใใ | |
| User::find($user_id)->decreament('points', 50); | |
This file contains hidden or 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
| //view_countใไธใคใซใฆใณใใขใใใใ | |
| Post::find($post_id)->increment('view_count'); | |
| //ใใคใณใใ50ๅ ็ฎใใ | |
| User::find($user_id)->increment('points', 50); | |
This file contains hidden or 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
| //ใใฃใจใๆ่ฟใซๆดๆฐใใใใฌใณใผใ | |
| $lastUpdatedUser = User::newest('updated_at')->first(); | |
This file contains hidden or 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
| //้้ | |
| User::newest()->get(); | |
| //ๆ้ | |
| User::oldest()->get(); | |
This file contains hidden or 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
| //้้ | |
| User::orderBy('created_at', 'desc')->get(); | |
| //ๆ้ | |
| User::orderBy('created_at', 'asc')->get(); | |
This file contains hidden or 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
| bin/cake migrations status | |
| Status Migration ID Migration Name | |
| up 20211113120214 CreateHoge0 | |
| up 20211113121301 CreateHoge1 | |
| up 20211113121453 CreateHoge2 | |
| bin/cake migrations rollback -t 20211113121453 | |
This file contains hidden or 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
| bin/cake migrations rollback | |
This file contains hidden or 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
| bin/cake migrations migrate -t 20211113121301 | |
This file contains hidden or 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
| bin/cake migrations status | |
| Status Migration ID Migration Name | |
| up 20211113120214 CreateHoge0 | |
| up 20211113121301 CreateHoge1 | |
| up 20211113121453 CreateHoge2 |
NewerOlder