Skip to main content

Eloquent Assertions: AssertModelExists

Premium
2 min read

A short lesson mentioning the assertion helpers related to Eloquent models.


Instead of a typical assertDatabaseHas() to check the database for specific tables and fields, if you are checking the Eloquent model, you may use the entire model and a assertModelExists(). Then, you won't need to specify the table and the fields. You will only provide the Eloquent model.

Laravel is smart enough to guess the table from...

The Full Lesson is Only for Premium Members

Want to access all of our courses? (30 h 33 min)

You also get:

55 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

No comments yet…

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.