PHP code example of theoluirard / laravel-get-table-name
1. Go to this page and download the library: Download theoluirard/laravel-get-table-name library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
theoluirard / laravel-get-table-name example snippets
namespace App\Models;
use HasTreeStructure;
use Illuminate\Database\Eloquent\Model;
class MyModel extends Model
{
use HasTreeStructure;
}
MyModel::getTableName(); // Returns "my_table_name"
MyModel::getTableName(true); // Returns "my_connection.my_table_name"
MyModel::getTableName(); // Returns "my_primary_key"
MyModel::getTableName(true); // Returns "my_table_name.my_primary_key"