<?php /** * Created by Cristian. * Date: 11/09/16 09:00 PM. */ namespace Reliese\Coders\Model; use Illuminate\Support\Arr; use Reliese\Meta\Blueprint; class Config { /** * @var array */ protected $config; /** * ModelConfig constructor. * * @param array $config */ public function __construct($config = []) { $this->config = $config; } /** * @param \Reliese\Meta\Blueprint $blueprint * @param string $key * @param mixed $default * * @return mixed */ public function get(Blueprint $blueprint, $key, $default = null) { $priorityKeys = [ "@connections.{$blueprint->connection()}.{$blueprint->table()}.$key", "@connections.{$blueprint->connection()}.{$blueprint->schema()}.$key", "@connections.{$blueprint->connection()}.$key", "{$blueprint->qualifiedTable()}.$key", "{$blueprint->schema()}.$key", "*.$key", ]; foreach ($priorityKeys as $key) { $value = Arr::get($this->config, $key); if (!is_null($value)) { return $value; } } return $default; } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Relations | Folder | 0755 |
|
|
Templates | Folder | 0755 |
|
|
Config.php | File | 1.2 KB | 0644 |
|
Factory.php | File | 17.71 KB | 0644 |
|
Model.php | File | 25.74 KB | 0644 |
|
ModelManager.php | File | 1.48 KB | 0644 |
|
Mutation.php | File | 742 B | 0644 |
|
Mutator.php | File | 1.62 KB | 0644 |
|
Relation.php | File | 397 B | 0644 |
|