1. Go to this page and download the library: Download shadetheartist/schema-info 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/ */
namespace App;
use SchemaInfo\Facades\SchemaInfo;
class Example
{
public function example()
{
$schema = SchemaInfo::make();
}
public function exampleAltConnection()
{
//connect to a different database. note: only mysql databases are currently supported.
$schema = SchemaInfo::make(\DB::connection('my-alternative-connection'));
}
}
$table = $schema->table('my_table_name');
//returns a stdClass instance refecting a record from the schema info of your database.
$info = $table->info();
$column = $table->column('my_column_name');
//returns a stdClass instance refecting a record from the schema info of your database.
$column->info();
//get the table the column belongs to.
$parentTable = $column->table();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.