CodeIgniter dynamic database in database.php - codeigniter

I want to change a variable in database.php to be dynamic. I want to create a field to get a value and then pass it into a variable in database.php instead.

You could always modify the database.php file via http://www.tizag.com/phpT/filewrite.php

Related

Laravel blade template name from database

I have a master blade file which will include another blade file based on a DB value like so:
#include('sign/templates/{{$SignRequest->form_template}}')
The db field form_template contains the name of the blade file to include. This name is passed to the master blade file correctly, but I can't figure out how to use this value within the include statement.
I get the following error:
View [sign.templates.<?php echo e($SignRequest->form_template); ?>] not found.
#include('sign.templates.'.$SignRequest->form_template)

Can't set session manually

I'm new in Laravel 5.8 and I need to set a session manually I use this code Session::set('subset', 'yes'); but I get error how to set session manually in Laravel 5.8
Set the session variable with value as follows..
Session::put('key','value');
Retrieve value using
In controller
$value = Session::get('key');
In view
{{Session::get('key')}}
You can use the global session helper which is available in laravel 5.8.
Set session simply by using
session(['key' => 'value']);
Retrieve session using
$value = session('key');

Use tables prefix for spatie/laravel-tags tables

In my Laravel 5.7 app, I use spatie/laravel-tags: ^2.1. I need to use a prefix for table names and I set table property of any model with prefix and with empty prefix property in config/database.php. It works for my model, except the tag model,
when I use method findOrCreate from Spatie\Tags\Tag.
I got error that table “tags” not found, as my prefix is not set.
If there is a way to set this prefix(config options?) ?
sure decision without modifications of vendor/spatie/laravel-tags/src/Tag.php file preferable...
Thanks!

PhpStorm suggest MySQL database column name

I am interested in how to do MySQL column name suggestion.
Here is my simple database.
This is my php code in route/web.php
This is my about.blade.php file
I want it to suggest me MySQL column name like id, body, created_as, update_at.. like this $task->... and here to suggest me all the column names which has table.
Is this possible?
Sort of.
However, you wouldn't be able to use the DB class, you'd need to create a Model and create the appropriate #property tags in the docblock.
Sometimes it works, sometimes it doesn't I have noticed. It really depends if PHPStorm picks up the proper context. It likely won't be picked up automatically in blade templates but you can type hint any variable:
/** #var TaskModel $task */
There is a good plugin for IDE autocompletion with regards to Laravel here: https://github.com/barryvdh/laravel-ide-helper

Saving Extension Config Data Magento

I've been trying to figure out exactly how does magento save the config data for a module given in System.xml. reason?I would like to edit the data provided by the user before storing it in the database.
Any clues????
Take a look at Mage_Core_Model_Store::setConfig function (and getConfig for reading the value). You will probbably have to write an observer that will listen to store_save_before event.
Magento stores configuration data in core_config_data database table - path column is the hierarhical structure of XML elements in system.xml file and is the same as XPath used for reading the default value out of config.xml file and value column contains the value that was saved.
When accessing the data with for e.g. Mage::getStoreConfig( 'path', $storeId ); Magento first searches the table for path-value pair and if it doesn't find it it reads the default value from config.xml file.

Resources