In this section you'll find links submitted by others.

Did you write or stumbled across a blog post, tutorial or video that might be interesting for others?

To be able to submit a link you need to log in first.

Log in

Get the Table Name From a Model in Laravel - submitted by Abrar Ahmad

Sometimes we need to reference table names throughout our codebase, like when we're using the DB facade. Although table names don't change often, I still get an uneasy feeling of hardcoding them. It's so much better to reference the model directly so we have one source of truth for the table name. So, let's learn how to do that! We'll also create a trait that allows static access to any of our model table names to keep our code a little tidier.