本文整理汇总了PHP中Illuminate\Support\Facades\Storage::append方法的典型用法代码示例。如果您正苦于以下问题:PHP Storage::append方法的具体用法?PHP Storage::append怎么用?PHP Storage::append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Storage
的用法示例。
在下文中一共展示了Storage::append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
// Query the CUCM to get numbers in the None partition
$res = Utils::executeQuery('SELECT dnorpattern, description FROM numplan WHERE fkroutepartition IS NULL AND tkpatternusage = 2', $this->cluster);
// Create a line in the CSV for the Cluster heading
Storage::append($this->outFile, $this->cluster->name . ',' . $this->cluster->ip);
//If we got results.....
if ($res) {
//Add the results to our CSV file
foreach ($res as $dn) {
Storage::append($this->outFile, implode(",", [$dn->dnorpattern, $dn->description]));
}
}
}
示例2: getConnections
/**
* getConnections() function fetches all connections from
* connection and table specified. Then returns a path
* to a configuration file which gets imported and
* deleted.
*
* @param $connection
* @param $table
* @return null|string
*/
public static function getConnections($connection, $table)
{
$connections = DB::connection($connection)->table($table)->get();
if (!empty($connections)) {
/**
* Create an empty array which will get populated with the data from
* $connections in the correct format within the foreach statement
* below file generation.
*/
$config = array();
/**
* Generate a random string for the filename as it is temporary
* and more secure.
*/
$random_string = ConnectionLoader::random_string(35);
/**
* Append the .php extension to the file name and store here
* storage_path/app/$tempFile with some starting content.
*/
$tempFileName = $random_string . '.php';
$tempFile = Storage::disk('local')->put($tempFileName, '<?php return ');
if ($tempFile === true) {
/**
* Loops through the connections checking the driver and pushes
* correctly formatted array into the $config array.
*/
foreach ($connections as $connection) {
$name = $connection->name;
$driver = $connection->driver;
if ($driver == 'sqlite') {
$connection_config = array('driver' => $driver, 'database' => database_path($connection->database), 'prefix' => $connection->prefix);
$config[$name] = $connection_config;
} elseif ($driver == 'mysql') {
$strict = $connection->strict;
if ($strict == 1) {
$strict = true;
} else {
$strict = false;
}
$password = $connection->password;
if (empty($password)) {
$connection_config = array('driver' => $driver, 'host' => $connection->host, 'database' => $connection->database, 'username' => $connection->username, 'password' => $password, 'charset' => $connection->charset, 'collation' => $connection->collation, 'prefix' => $connection->prefix, 'strict' => $strict);
} else {
$connection_config = array('driver' => $driver, 'host' => $connection->host, 'database' => $connection->database, 'username' => $connection->username, 'password' => Crypt::decrypt($password), 'charset' => $connection->charset, 'collation' => $connection->collation, 'prefix' => $connection->prefix, 'strict' => $strict);
}
$config[$name] = $connection_config;
} elseif ($driver == 'pgsql') {
$password = $connection->password;
if (empty($password)) {
$connection_config = array('driver' => $driver, 'host' => $connection->host, 'port' => $connection->port, 'database' => $connection->database, 'username' => $connection->username, 'password' => $password, 'charset' => $connection->charset, 'prefix' => $connection->prefix, 'schema' => $connection->schema);
} else {
$connection_config = array('driver' => $driver, 'host' => $connection->host, 'port' => $connection->port, 'database' => $connection->database, 'username' => $connection->username, 'password' => Crypt::decrypt($password), 'charset' => $connection->charset, 'prefix' => $connection->prefix, 'schema' => $connection->schema);
}
$config[$name] = $connection_config;
}
}
/**
* Append a var_export of $config to the temporary file and
* append the semicolon.
*
* Returns the temporary filename.
*/
$endFile = ';';
Storage::append($tempFileName, var_export($config, true));
Storage::append($tempFileName, $endFile);
return $tempFileName;
} else {
\error_log('Unable to create temporary file');
}
} else {
\error_log('Configuration File Connection Invalid.');
return null;
}
}