本文整理汇总了PHP中zbase_config_get函数的典型用法代码示例。如果您正苦于以下问题:PHP zbase_config_get函数的具体用法?PHP zbase_config_get怎么用?PHP zbase_config_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zbase_config_get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: zbase_cache
/**
* Return a value from cache else save new
*
* @param string $key
* @param \Closure $callback
* @param integer $minutes number of minutes to store items. Default: 60m
* @return mixed
*/
function zbase_cache($key, \Closure $callback, array $tags = null, $minutes = 60, $options = array())
{
if ($minutes === null) {
$minutes = 60;
}
$logFile = !empty($options['logFile']) ? $options['logFile'] : __FUNCTION__;
$logMsg = !empty($options['logMsg']) ? $options['logMsg'] : __FUNCTION__;
if (zbase_cache_has($key, $tags, $options)) {
zbase_log($key . ' -- CACHE HIT' . PHP_EOL . $logMsg, null, $logFile);
return zbase_cache_get($key, $tags, $options);
}
zbase_log($key . ' -- CACHE MISS' . PHP_EOL . $logMsg, null, $logFile);
/**
* Force Cache Entity Level
*/
$forceCaching = zbase_config_get('db.cache.force', true);
if (!empty($options['forceCache']) && !empty($forceCaching)) {
$value = $callback();
zbase_cache_save($key, $value, $minutes, $tags, $options);
return $value;
}
if (!zbase_cache_enable()) {
return $callback();
}
$value = $callback();
zbase_cache_save($key, $value, $minutes, $tags, $options);
return $value;
// return \Cache::remember($key, $minutes, $callback);
}
开发者ID:claremontdesign,项目名称:zbase,代码行数:37,代码来源:cache.php
示例2: registerEnabled
/**
* If registration is enabled
* @return boolean
*/
public function registerEnabled()
{
if ($this->authEnabled()) {
return zbase_config_get('auth.register.enable', true);
}
return false;
}
开发者ID:claremontdesign,项目名称:zbase,代码行数:11,代码来源:User.php
示例3: zbase_auth_minimum
/**
* Return the Minimum Access for the section
* @return string
*/
function zbase_auth_minimum()
{
if (zbase_is_back()) {
if (zbase_route_username()) {
return zbase_route_username_minimum_access();
}
return zbase_config_get('auth.access.minimum.back', 'admin');
}
return zbase_config_get('auth.access.minimum.front', 'guest');
}
开发者ID:claremontdesign,项目名称:zbase,代码行数:14,代码来源:auth.php
示例4: zbase_url_from_route
/**
* Create a URL Based from a route $name
* @param type $name
* @param type $params
*/
function zbase_url_from_route($name, $params = [], $relative = false)
{
if (!\Route::has($name)) {
return '#';
}
$routes = zbase_config_get('routes');
$prefix = '';
$name = str_replace('admin.', zbase_admin_key() . '.', $name);
$name = str_replace('admin', zbase_admin_key(), $name);
$usernameRouteEnabled = zbase_route_username();
if (isset($routes[$name]['usernameroute'])) {
if ($routes[$name]['usernameroute'] === false) {
$usernameRouteEnabled = false;
}
}
if (!empty($usernameRouteEnabled)) {
$usernameRouteParameterName = zbase_route_username_prefix();
$usernameRoute = zbase_route_username_get();
$username = zbase_route_input(zbase_route_username_prefix(), false);
if (!empty($username)) {
$username = strtolower($username);
$user = zbase_user_by('username', $username);
if ($user instanceof \Zbase\Entity\Laravel\User\User && $user->hasUrl()) {
$usernameRoute = true;
}
}
if (empty($usernameRoute) && zbase_auth_has() && zbase_is_back()) {
$username = zbase_auth_user()->username();
$usernameRoute = true;
}
if (!empty($usernameRoute)) {
$prefix = $usernameRouteParameterName;
if (empty($params[$usernameRouteParameterName])) {
$params[$usernameRouteParameterName] = $username;
}
}
}
$name = $prefix . $name;
if (!empty($relative)) {
$home = route('index');
$url = str_replace($home, '', route($name, $params));
} else {
$url = route($name, $params);
}
if ($usernameRouteEnabled && !empty($usernameRoute)) {
$url = str_replace($usernameRoute . '/' . $usernameRoute, '/' . $usernameRoute . '/', $url);
}
return $url;
}
开发者ID:claremontdesign,项目名称:zbase,代码行数:54,代码来源:url.php
示例5: testzbase_data_get
/**
* @return void
* @test
*/
public function testzbase_data_get()
{
$config = ['key' => ['keyTwo' => ['keyThree' => ['keyFour' => 'keyFourValue']]]];
$this->assertEquals('keyFourValue', zbase_data_get($config, 'key.keyTwo.keyThree.keyFour'));
$this->assertSame(['keyThree' => ['keyFour' => 'keyFourValue']], zbase_data_get($config, 'key.keyTwo'));
// Test configReplace
$arrOne = ['template' => ['someTag' => ['configReplace' => 'view.template.otherTag', 'front' => ['package' => 'someThemePackage', 'theme' => 'someThemeName']], 'otherTag' => ['front' => ['package' => 'someOtherTagThemePackage', 'theme' => 'someOtherTagThemeName']]]];
zbase_config_set('view', $arrOne);
$expected = ['front' => ["package" => "someOtherTagThemePackage", "theme" => "someOtherTagThemeName"]];
$this->assertSame($expected, zbase_config_get('view.template.someTag'));
// Test configMerge
$arrOne = ['template' => ['someTag' => ['configMerge' => 'view.template.otherTag', 'front' => ['package' => 'someThemePackage', 'theme' => 'someThemeName']], 'otherTag' => ['front' => ['package' => 'someOtherTagThemePackage', 'theme' => 'someOtherTagThemeName']]]];
zbase_config_set('view', $arrOne);
$expected = ['front' => ["package" => ["someThemePackage", "someOtherTagThemePackage"], "theme" => ["someThemeName", "someOtherTagThemeName"]]];
$this->assertSame($expected, zbase_config_get('view.template.someTag'));
// Test inheritedValue
$arrOne = ['template' => ['someTag' => ['front' => ['package' => 'someThemePackage', 'theme' => 'inheritValue::view.template.otherTag.front.theme']], 'otherTag' => ['front' => ['package' => 'someOtherTagThemePackage', 'theme' => 'someOtherTagThemeName']]]];
zbase_config_set('view', $arrOne);
$this->assertSame('someOtherTagThemeName', zbase_config_get('view.template.someTag.front.theme'));
}
开发者ID:claremontdesign,项目名称:zbase,代码行数:24,代码来源:HelpersTest.php
示例6: getColor
/**
* Return the Color
*/
public function getColor()
{
$theme = zbase_config_get('theme.ui.component.button.color.' . $this->tag . '.' . $this->color, null);
if (!empty($theme)) {
return $theme;
}
if ($this->tag == 'a') {
return $this->color;
}
if ($this->color == 'green') {
return 'btn-success';
}
if ($this->color == 'blue') {
return 'btn-info';
}
if ($this->color == 'red') {
return 'btn-danger';
}
if ($this->color == 'yellow') {
return 'btn-warning';
}
return 'btn-' . $this->color;
}
开发者ID:claremontdesign,项目名称:zbase,代码行数:26,代码来源:Button.php
示例7: sendPaymentReceiptToShane
/**
* Send Order pHoto to Shane
*/
public function sendPaymentReceiptToShane()
{
$token = zbase_config_get('zivsluck.telegram.bot.token');
$shane = zbase_config_get('zivsluck.telegram.shane');
$enable = env('ZIVSLUCK_TELEGRAM', zbase_config_get('zivsluck.telegram.enable', false));
if ($enable) {
$folder = zbase_storage_path() . '/zivsluck/order/receipts/';
$image = $folder . $this->id() . '.png';
$url = 'https://api.telegram.org/bot' . $token . '/sendPhoto?chat_id=' . $shane;
$post_fields = array('chat_id' => $shane, 'photo' => new \CURLFile(realpath($image)), 'caption' => 'Payment received from ' . $this->name . ' via ' . $this->paymentMerchant() . ' for Order ID ' . $this->maskedId());
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type:multipart/form-data"));
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
curl_exec($ch);
}
}
开发者ID:dennesabing,项目名称:zivsluck,代码行数:21,代码来源:Order.php
示例8: function
* @copyright Copyright (c) 2015 ClaremontDesign/MadLabs-Dx
* @version 0.0.0.1
* @since Mar 5, 2016 11:51:42 PM
* @file dsstore/module.php
*
*/
return ['id' => 'testing', 'enable' => true, 'backend' => false, 'frontend' => false, 'routes' => ['generate_password' => ['usernameRouteCheck' => false, 'url' => '/test/generate-password/{password?}', 'view' => ['enable' => true, 'layout' => 'blank', 'name' => 'type.html', 'content' => function () {
$password = zbase_route_input('password');
dd($password, zbase_bcrypt($password));
}]], 'testing_email_sending' => ['usernameRouteCheck' => false, 'url' => '/test/email-sending/{action?}', 'view' => ['enable' => true, 'layout' => 'blank', 'name' => 'type.html', 'content' => function () {
$user = zbase_entity('user')->by('username', 'dennesabing');
$params = [];
$params['token'] = zbase_generate_code();
$to = '[email protected]';
$fromEmail = zbase_config_get('email.noreply.email');
$fromName = zbase_config_get('email.noreply.name');
$subject = 'Test Subject';
$headers = "From: " . $fromName . " <{$fromEmail}>\r\n";
$headers .= "Reply-To: " . $fromName . " <{$fromEmail}>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
//$message = zbase_view_render(zbase_view_file_contents('auth.password.email.password'), $params);
//$sent = mail($to, $subject, $message, $headers);
//dd($sent, $to, $fromEmail, $message);
dd(zbase_messenger_email($to, 'noreply', $subject, zbase_view_file_contents('auth.password.email.password'), $params));
}]], 'testing_email_template' => ['usernameRouteCheck' => false, 'url' => '/test/templates/email/{type?}', 'view' => ['enable' => true, 'layout' => 'blank', 'name' => 'type.html', 'content' => function () {
$type = zbase_route_input('type');
/**
* test/templates/email/forgot-password
*/
if ($type == 'forgot-password') {
开发者ID:claremontdesign,项目名称:zbase,代码行数:31,代码来源:module.php
示例9: function
*
* @link http://dennesabing.com
* @author Dennes B Abing <[email protected]>
* @license proprietary
* @copyright Copyright (c) 2015 ClaremontDesign/MadLabs-Dx
* @version 0.0.0.1
* @since Mar 8, 2016 10:37:59 AM
* @file widget.php
* @project Expression project.name is undefined on line 13, column 15 in Templates/Scripting/EmptyPHP.php.
* @package Expression package is undefined on line 14, column 15 in Templates/Scripting/EmptyPHP.php.
*
*/
return ['type' => 'form', 'enable' => function () {
return zbase_config_get('modules.account.widgets.username.enable', true);
}, 'config' => ['entity' => ['name' => 'user', 'node' => ['enable' => true], 'repo' => ['byId' => ['route' => 'id']]], 'event' => ['username' => ['post' => ['redirect' => ['enable' => false]]]], 'submit' => ['button' => ['label' => 'Update Username']], 'form' => ['startTag' => ['action' => function () {
return zbase_url_from_route('admin.users', ['action' => 'username', 'id' => zbase_route_input('id')]);
}, 'html' => ['attributes' => ['class' => ['zbase-ajax-form']]]]], 'elements' => ['username' => ['type' => 'text', 'id' => 'username', 'enable' => function () {
return zbase_config_get('auth.username.enable', false);
}, 'label' => 'Username', 'entity' => ['property' => 'username'], 'angular' => ['ngModel' => 'currentUser.username'], 'validations' => ['required' => ['enable' => true, 'message' => 'Username is required.'], 'unique' => ['enable' => true, 'text' => function () {
return 'unique:' . zbase_entity('user')->getTable() . ',username,' . zbase_auth_user()->id() . ',user_id';
}, 'message' => 'Username already exists.'], 'regex' => ['enable' => true, 'text' => function () {
return 'regex:/^[a-z][a-z0-9]{5,31}$/';
}, 'message' => 'Invalid username.'], 'min' => ['enable' => true, 'text' => function () {
return 'min:5';
}, 'message' => 'Username should be of 5 up to 32 characters.'], 'max' => ['enable' => true, 'text' => function () {
return 'max:32';
}, 'message' => 'Username should be of 5 up to 32 characters.'], 'not_in' => ['enable' => true, 'text' => function () {
$notAllowedUsernames = (require zbase_path_library('notallowedusernames.php'));
$notAllowedUsernames[] = zbase_auth_user()->username();
return 'not_in:' . implode(',', $notAllowedUsernames);
}, 'message' => 'Please provide a different username.']]]]]];
开发者ID:claremontdesign,项目名称:zbase,代码行数:31,代码来源:admin-user-username.php
示例10: zbase_config_get
* @link http://dennesabing.com
* @author Dennes B Abing <[email protected]>
* @license proprietary
* @copyright Copyright (c) 2015 ClaremontDesign/MadLabs-Dx
* @version 0.0.0.1
* @since Sep 9, 2016 10:11:07 PM
* @file account.blade.php
* @project Zbase
* @package Expression package is undefined on line 14, column 15 in Templates/Scripting/EmptyPHP.php.
*/
$profile = zbase_config_get('modules.account.widgets.profile.enable', true);
$image = zbase_config_get('modules.account.widgets.image.enable', true);
$email = zbase_config_get('modules.account.widgets.email.enable', true);
$username = zbase_config_get('modules.account.widgets.username.enable', true);
$password = zbase_config_get('modules.account.widgets.password.enable', true);
$notification = zbase_config_get('modules.account.widgets.notifications.enable', true);
$currentUser = zbase_auth_user();
$moduleName = 'account';
$isAdmin = $currentUser->isAdmin();
$adminView = false;
if ($isAdmin && !empty(zbase_route_input('id'))) {
$adminView = true;
$moduleName = 'admin-user';
$selectedUser = zbase_user_byid(zbase_route_input('id'));
if (!$selectedUser instanceof \Zbase\Entity\Laravel\User\User) {
zbase_abort(404);
exit;
}
$page = [];
$page['title'] = '<span class="userDisplayName' . $selectedUser->id() . '">' . $selectedUser->roleTitle() . ' - ' . $selectedUser->id() . ': ' . $selectedUser->displayName() . '</span>' . $selectedUser->statusText();
$page['headTitle'] = $selectedUser->displayName();
开发者ID:claremontdesign,项目名称:zbase,代码行数:31,代码来源:account.blade.php
示例11: entity
/**
* Return the Entity Model of a given entityName
*
* @param string $entityName Entity name
* @param array $entityConfig EntityConfiguration
* @param boolean|string $newInstance will create new instance.
* @return Zbase\Entity\Entity
*/
public function entity($entityName, $entityConfig = [], $newInstance = true)
{
if (empty($newInstance)) {
if (!empty($this->entityModels[$entityName])) {
return $this->entityModels[$entityName];
}
}
if (empty($entityConfig)) {
$entityConfig = zbase_config_get('entity.' . $entityName, []);
}
if (!empty($entityConfig)) {
$modelName = zbase_class_name(!empty($entityConfig['model']) ? $entityConfig['model'] : null);
if (!empty($modelName)) {
if (!empty($newInstance)) {
return new $modelName();
}
return $this->entityModels[$entityName] = new $modelName();
}
throw new Exceptions\ConfigNotFoundException('Entity "model" configuration for "' . $entityName . '" not found in ' . __CLASS__);
}
//$value = app()['config']['entity'];
//dd($value, zbase_config_get('entity'), $entityName, $entityConfig);
throw new Exceptions\ConfigNotFoundException('Entity configuration for "' . $entityName . '" not found in ' . __CLASS__);
}
开发者ID:claremontdesign,项目名称:zbase,代码行数:32,代码来源:Zbase.php
示例12: zbase_domain
/**
* ZBASE_SITE_DOMAIN
* return the Site Domain
* @return string
*/
function zbase_domain()
{
return str_replace(array('http://', 'https://', 'www'), '', env('APP_URL', zbase_config_get('site.domain', 'zzbase.com')));
}
开发者ID:claremontdesign,项目名称:zbase,代码行数:9,代码来源:common.php
示例13: url
/**
* Create a URL based from params
* @param string $section The Section to generate the route
* @param array $params Params to generate route
* @return string
*/
public function url($section, $params)
{
if ($section == 'backend' || $section == 'back') {
$adminKey = zbase_config_get('routes.adminkey.key', 'admin');
$routeName = $adminKey . '.' . $this->id();
} else {
$routeName = $this->id();
}
return zbase_url_from_route($routeName, $params);
}
开发者ID:claremontdesign,项目名称:zbase,代码行数:16,代码来源:Module.php
示例14: wrapperAttributes
/**
* Return the Wrapper Attributes
* @return array
*/
public function wrapperAttributes()
{
$someAttributes = property_exists($this, '_htmlWrapperAttributes') ? $this->_htmlWrapperAttributes : [];
$generalAttributes = zbase_config_get('ui.' . $this->_type . '.html.attributes.wrapper', []);
$attr = array_merge_recursive($this->_v('html.attributes.wrapper', []), $someAttributes, $generalAttributes);
$attr['class'][] = 'zbase-ui-wrapper';
$attr['id'] = 'zbase-ui-wrapper-' . $this->id();
return $attr;
}
开发者ID:claremontdesign,项目名称:zbase,代码行数:13,代码来源:Ui.php
示例15: zbase_config_get
<div class="form-group" id="form-group-material">
<label for="material">Material</label>
<select name="material" id="material" class="form-control">
<option value="stainless">Stainless</option>
<option value="silver">Silver</option>
<option value="goldplated">Gold Plated</option>
</select>
</div>
<div class="form-group" id="form-group-chain" style="display: none;">
<div class="form-group" >
<label for="chain">Chain</label>
</div>
<div class="row">
<?php
$chains = zbase_config_get('zivsluck.chains', false);
if (!empty($chains)) {
foreach ($chains as $chainType => $chainTypes) {
foreach ($chainTypes as $chainId => $chain) {
if (!empty($chain['enable'])) {
?>
<div onclick="zivsluck_selectChain('<?php
echo $chain['name'];
?>
');" data-name="<?php
echo $chain['name'];
?>
" class="col-md-4 chain-type-group-<?php
echo !empty($chain['group']) ? $chain['group'] : null;
?>
chain-type-<?php
开发者ID:dennesabing,项目名称:zivsluck,代码行数:31,代码来源:customize.blade.php
示例16:
<?php
if (zbase_config_get('view.package.templates.metronic.themeCustomizer', false)) {
?>
<!-- BEGIN STYLE CUSTOMIZER -->
<div class="theme-panel hidden-xs hidden-sm">
<div class="toggler">
</div>
<div class="toggler-close">
</div>
<div class="theme-options">
<div class="theme-option theme-colors clearfix">
<span>
THEME COLOR
</span>
<ul>
<li class="color-black current color-default" data-style="default">
</li>
<li class="color-blue" data-style="blue">
</li>
<li class="color-brown" data-style="brown">
</li>
<li class="color-purple" data-style="purple">
</li>
<li class="color-grey" data-style="grey">
</li>
<li class="color-white color-light" data-style="light">
</li>
</ul>
</div>
<div class="theme-option">
开发者ID:claremontdesign,项目名称:zbase,代码行数:31,代码来源:themeCustomizer.blade.php
示例17: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// $migrateCommand = app('command.migrate');
if (!zbase_is_dev()) {
// $migrateCommand->info('You are in PRODUCTION Mode. Cannot drop tables.');
return false;
}
//echo " - Dropping\n";
//$migrateCommand->info('- Dropping');
$entities = zbase_config_get('entity', []);
if (!empty($entities)) {
\DB::statement('SET FOREIGN_KEY_CHECKS = 0');
foreach ($entities as $entity) {
$enable = zbase_data_get($entity, 'enable', false);
$model = zbase_data_get($entity, 'model', null);
if (is_null($model)) {
continue;
}
$modelName = zbase_class_name($model);
$isPostModel = zbase_data_get($entity, 'post', false);
if (!empty($isPostModel)) {
$postModel = zbase_object_factory($modelName);
if ($postModel instanceof \Zbase\Post\PostInterface) {
$entity = $postModel->postTableConfigurations($entity);
}
} else {
if (method_exists($modelName, 'entityConfiguration')) {
$entity = $modelName::entityConfiguration($entity);
}
}
$tableName = zbase_data_get($entity, 'table.name', null);
if (!empty($enable) && !empty($tableName)) {
if (Schema::hasTable($tableName)) {
Schema::drop($tableName);
// echo " -- Dropped " . $tableName . "\n";
//$migrateCommand->info(' -- Dropped ' . $tableName);
}
}
}
\DB::statement('SET FOREIGN_KEY_CHECKS = 1');
}
}
开发者ID:claremontdesign,项目名称:zbase,代码行数:47,代码来源:2016_01_21_000000_create_table.php
示例18: packagename_config_get
/**
* Return a Package name specific configuration
* @param string $key The Key to return
* @param mixed $default Default value
* @return mixed
*/
function packagename_config_get($key, $default = null)
{
$package = packagename_tag();
return zbase_config_get($package . '.' . $key, $default);
}
开发者ID:claremontdesign,项目名称:zbase,代码行数:11,代码来源:helpers.php
示例19: zbase_url_from_route
<li>Once payment has been made, please send us a copy of the deposit slip as Proof of Payment.</li>
<li>You can send to us the deposit/payment slip using the Update Order page at
<a target="_blank" href="<?php
echo zbase_url_from_route('orderUpdate');
?>
">http://zivsluck.com/update-order</a>.</li>
<li><strong>No Proof of Payment, No Processing of Order.</strong></li>
<li>No cancellation of order once payment has been made.</li>
<li>No rush orders</li>
</ul>
</div>
<div class="col-md-12">
<h3>Pay only through these Remittance Centers:</h3>
<?php
$paymentCenters = zbase_config_get('zivsluck.paymentCenters');
if (!empty($paymentCenters)) {
foreach ($paymentCenters as $paymentCenter) {
if (!empty($paymentCenter['enable'])) {
echo '<div class="col-md-2 paymentCenter" style="margin-bottom: 20px;"><img src="/zbase/assets/zivsluck/img/payments/' . $paymentCenter['file'] . '"></div>';
}
}
}
?>
</div>
<div class="col-md-12">
<h3>Use the information below when paying through a Remittance Center:</h3>
<address>
<strong>Gladdys Joi Gamat</strong>
<br />
Countryside Village, Bangkal<br />
开发者ID:dennesabing,项目名称:zivsluck,代码行数:31,代码来源:confirm.blade.php
示例20: _relations
/**
* Seed Related tables/models
* @param array $relations
* @param array $f
*/
protected function _relations($relations, $f)
{
if (!empty($relations)) {
foreach ($relations as $rEntityName => $rEntityConfig) {
$rInverse = !empty($rEntityConfig['inverse']) ? true : false;
if ($rInverse) {
continue;
}
$rEntityName = !empty($rEntityConfig['entity']) ? $rEntityConfig['entity'] : $rEntityName;
$rEntity = zbase_config_get('entity.' . $rEntityName, []);
if (!empty($rEntity)) {
$type = zbase_data_get($rEntityConfig, 'type', []);
$fData = [];
if ($type == 'onetoone') {
/**
* https://laravel.com/docs/5.2/eloquent-relationships#one-to-many
*/
$foreignKey = zbase_data_get($rEntityConfig, 'keys.foreign', []);
$localKey = zbase_data_get($rEntityConfig, 'keys.local', []);
if (!empty($f[$localKey])) {
$fData[$foreignKey] = $f[$localKey];
}
$this->_rows($rEntityName, $rEntity, $fData, true);
}
if ($type == 'manytomany') {
/**
* We need to run factory for the related entity
*/
$this->_defaults($rEntityName, $rEntity, true);
$this->_factory($rEntityName, $rEntity, true);
/**
* https://laravel.com/docs/5.2/eloquent-relationships#many-to-many
*
* Data will be inserted into the pivot table
*/
$pivot = zbase_data_get($rEntityConfig, 'pivot', []);
$pivotTableName = zbase_config_get('entity.' . $pivot . '.table.name', []);
/**
* the foreign key name of the model on which you are defining the relationship
*/
$localKey = zbase_data_get($rEntityConfig, 'keys.foreign', []);
/**
* the foreign key name of the model that you are joining to
* We will select random data from this entity
*/
$foreignKey = zbase_data_get($rEntityConfig, 'keys.local', []);
$fTableName = zbase_data_get($rEntity, 'table.name', null);
// dd($foreignKey, $fTableName);
$foreignTwoValue = collect(\DB::table($fTableName)->lists($foreignKey))->random();
\DB::table($pivotTableName)->insert([$localKey => $f[$localKey], $foreignKey => $foreignTwoValue]);
}
}
}
}
}
开发者ID:claremontdesign,项目名称:zbase,代码行数:60,代码来源:DatabaseSeeder.php
注:本文中的zbase_config_get函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论