-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dynamic field and tables name Laravel 5.8 support
- Loading branch information
Showing
28 changed files
with
707 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
<phpunit bootstrap="vendor/autoload.php" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
verbose="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
> | ||
stopOnFailure="false"> | ||
<testsuites> | ||
<testsuite name="Laravel Model Settings Test Suite"> | ||
<directory suffix="Test.php">./tests/</directory> | ||
<testsuite name="Glorand Model Settings Test Suite"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">./src/</directory> | ||
<directory suffix=".php">src</directory> | ||
</whitelist> | ||
</filter> | ||
<logging> | ||
<!--<logging> | ||
<log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/> | ||
</logging> | ||
</logging>--> | ||
<php> | ||
|
||
<env name="DB_CONNECTION" value="testing" /> | ||
</php> | ||
</phpunit> | ||
</phpunit> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace Glorand\Model\Settings\Console; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Filesystem\Filesystem; | ||
use Illuminate\Support\Str; | ||
use Schema; | ||
|
||
class CreateSettingsTable extends Command | ||
{ | ||
/** @var string */ | ||
protected $signature = 'model-settings:model-settings-table'; | ||
|
||
/** @var string */ | ||
protected $description = 'Create migration for the settings table'; | ||
|
||
/** | ||
* @param \Illuminate\Filesystem\Filesystem $file | ||
* @return bool | ||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException | ||
*/ | ||
public function handle(Filesystem $file) | ||
{ | ||
$table = strtolower(config('model_settings.settings_table_name')); | ||
$table = Str::snake(trim($table)); | ||
if (empty($table)) { | ||
$this->error('The name of the table is required!'); | ||
|
||
return false; | ||
} | ||
|
||
if (Schema::hasTable($table)) { | ||
$this->error('Table "' . $table . '" already exists!'); | ||
|
||
return false; | ||
} | ||
|
||
$fileName = date('Y_m_d_His') . '_create_' . $table . '_table.php'; | ||
$path = database_path('migrations') . '/' . $fileName; | ||
$className = 'Create' . ucfirst(Str::camel($table)) . 'Table'; | ||
|
||
|
||
$stub = $file->get(__DIR__ . '/../../stubs/create_settings_table.stub'); | ||
$stub = str_replace('DummyClass', $className, $stub); | ||
$stub = str_replace('DummyTable', $table, $stub); | ||
|
||
$file->put($path, $stub); | ||
$this->line("<info>Created Migration:</info> {$fileName}"); | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Glorand\Model\Settings\Exceptions; | ||
|
||
use Exception; | ||
|
||
class ModelSettingsException extends Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.