How to get table name from model in Laravel 5?By Hardik Savani | August 22, 2016 | | 2365 Viewer | Category : Laravel
Share this post:
If you need to get table name from model in your laravel application then this post can help you to get table name. Laravel based on MVC. So, we require to create model for every table that way we can write database logic on model. But if you require to get table name from model then you can get using getTable() of model.
Laravel eloquent model provide several methos like for all(), get(), first() etc, that helps to get table record from model table.
You can get table name simply call getTable() of model object, so how to call this method as bellow example.
$item = new Item;
$table = $item->getTable();
- How to add Delete cascade to existing column in Laravel 5, without remove column?
- Laravel 5 dynamic autocomplete search using select2 JS Ajax - Part 1
- Laravel 5 - Authenticate user in NodeJS with socket io using JWT.
- Laravel 5 login with Linkedin using Socialite Package
- JQuery - Delete confirm modal using bootbox example
- Bootstrap progress bar animate example using bootstrap-progressbar.js
- Laravel 5 Repository Pattern Tutorial from scratch
- How to check if record exists or not in Laravel 5?