/** * Execute the console command. * * @return mixed */ public function handle() { $path = $this->getFilePath(); $directory = dirname($path); if ($this->file->exists($path)) { $this->error("A view already exists at {$path}!"); return false; } if (!$this->file->exists($directory)) { $this->file->makeDirectory($directory, 0777, true); } $this->file->put($path, $this->getViewContents()); $this->info("Created a new view at {$path}"); }
/** * Execute the console command. * * @return mixed */ public function fire() { //borrramos generaciones previas File::deleteDirectory(app_path('modelos_generados')); //creamos el directorio en app.. File::makeDirectory(app_path('modelos_generados'), 777); $tablas = SchemaHelper\Table::getTablesCurrentDatabase(); $this->info("Buscando tablas.."); foreach ($tablas as $tabla) { $this->info("Generando Modelo de la tabla: " . $tabla->table_name); //class name $class_name = ucfirst(camel_case(str_singular_spanish($tabla->table_name))); $baseString = File::get(app_path('models/Schema/Template.txt')); //replace class name.. $baseString = str_replace('@class_name@', $class_name, $baseString); //replace table name.. $baseString = str_replace('@table_name@', $tabla->table_name, $baseString); //replace pretty name.. $baseString = str_replace('@pretty_name@', $tabla->table_name, $baseString); //find columns. $columns = $tabla->columns()->whereNotIn('column_name', static::$common_hidden)->get(); //generate fillable $baseString = str_replace('@fillable@', $this->generarFillable($columns), $baseString); //generate pretty fields string. $baseString = str_replace('@pretty_fields@', $this->generarPrettyFields($columns), $baseString); //generate rules.. $baseString = str_replace('@rules@', $this->genenarRules($columns), $baseString); //generate belongs to.. $baseString = str_replace('@belongs_to@', $this->generarBelongsTo($columns), $baseString); File::put(app_path('modelos_generados/' . $class_name . '.php'), $baseString); } $this->info("Generación terminada."); }
public function __destruct() { if (true === $this->collection()->write) { File::delete($this->file); File::put($this->file, serialize($this->collection()->collection())); } }
public function getFile($lang = false, $module = false) { // dd(view()->shared('controller')); // app('request')->attributes->get('controller'); if (!$lang) { $lang = \App::getLocale(); } // Busca o arquivo especificado $cfg_file = mkny_lang_path($lang . '/' . $module) . '.php'; // Field types $f_types = array_unique(array_values(app()->make('Mkny\\Cinimod\\Logic\\AppLogic')->_getFieldTypes())); // Se o diretorio nao existir if (!realpath(dirname($cfg_file))) { \File::makeDirectory(dirname($cfg_file)); } // Config file data if (!\File::exists($cfg_file)) { \File::put($cfg_file, "<?php return array( 'teste' => 'teste' );"); } // Arquivo aberto $config_str = \File::getRequire($cfg_file); $arrFields = array(); foreach ($config_str as $field_name => $field_value) { if (!is_string($field_value)) { $arrFields[$field_name] = array('name' => $field_name, 'trans' => $field_name, 'values' => $field_value, 'type' => 'multi'); } else { $arrFields[$field_name] = array('name' => $field_name, 'trans' => $field_name, 'default_value' => $field_value, 'type' => 'string'); } } return view('cinimod::admin.generator.trans_detailed')->with(['form' => app()->make('\\Mkny\\Cinimod\\Logic\\FormLogic', [['fields-default-class' => 'form-control']])->getForm(false, action('\\' . get_class($this) . '@postFile', [$lang, $module]), $arrFields, $module)]); }
public function go() { //$feed = file_get_contents($_SERVER['DOCUMENT_ROOT'].'/_add-ons/wordpress/wp_posts.xml'); //$items = simplexml_load_string($feed); $posts_object = simplexml_load_file($_SERVER['DOCUMENT_ROOT'] . '/_add-ons/wordpress/roobottom_old_posts.xml'); $posts = object_to_array($posts_object); $yaml_path = $_SERVER['DOCUMENT_ROOT'] . '/_content/01-blog/'; foreach ($posts['table'] as $post) { if ($post['column'][8] == "publish") { $slug = Slug::make($post['column'][5]); $slug = preg_replace('/[^a-z\\d]+/i', '-', $slug); if (substr($slug, -1) == '-') { $slug = substr($slug, 0, -1); } $date = date('Y-m-d-Hi', strtotime($post['column'][3])); $file = $date . "-" . $slug . ".md"; if (!File::exists($yaml_path . $file)) { $yaml = []; $yaml['title'] = $post['column'][5]; $content = $post['column'][4]; $markdown = new HTML_To_Markdown($content, array('header_style' => 'atx')); File::put($yaml_path . $file, YAML::dump($yaml) . '---' . "\n" . $markdown); } echo $slug . "-" . $date; echo "<br/><hr/><br/>"; } } return "ok"; }
/** * @param $current_connection * @param $config_file_path * @return string */ function replaceCurrentConnection($current_connection, $config_file_path) { $connection_under_test = "'default' => '{$current_connection}'"; $content = preg_replace("/'default' => '[a-zA-Z]*'/", $connection_under_test, File::get($config_file_path)); File::put($config_file_path, $content); return $connection_under_test; }
/** * Execute the console command. * * @return void */ public function fire() { if (file_exists($compiled = base_path() . '/bootstrap/compiled.php')) { $this->error('Error generating IDE Helper: first delete bootstrap/compiled.php (php artisan clear-compiled)'); } else { $filename = $this->argument('filename'); if ($this->option('memory')) { $this->useMemoryDriver(); } $this->extra = \Config::get('laravel-ide-helper::extra'); $this->magic = \Config::get('laravel-ide-helper::magic'); if ($this->option('helpers') || \Config::get('laravel-ide-helper::include_helpers')) { $this->helpers = \Config::get('laravel-ide-helper::helper_files'); } else { $this->helpers = array(); } $content = $this->generateDocs(); $written = \File::put($filename, $content); if ($written !== false) { $this->info("A new helper file was written to {$filename}"); } else { $this->error("The helper file could not be created at {$filename}"); } } }
public function run() { DB::table('home_page')->delete(); $success = File::cleanDirectory($this->getImagesPath()); File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore')); HomePage::create(['headline' => "Industrial Legacy", 'text' => 'RUSTIC DETAILS. MODERN EDGE. REFINED LIVING IN COURT SQUARE. <br> 1 - 4 BEDROOM HOMES FROM $615K. PENTHOUSES PRICED UPON REQUEST.', 'subtext' => 'CHILDREN\'S PLAYROOM, LOUNGE, LIBRARY, GYM, TERRACE AND PARKING', 'image' => $this->copyImage(public_path() . '/backup_images/building/building.jpg')]); }
public static function instance($model, $db = null, $options = []) { $db = is_null($db) ? SITE_NAME : $db; $class = __NAMESPACE__ . '\\Model\\' . ucfirst(Inflector::lower($model)); $file = APPLICATION_PATH . DS . 'models' . DS . 'Mysql' . DS . ucfirst(Inflector::lower($db)) . DS . ucfirst(Inflector::lower($model)) . '.php'; if (File::exists($file)) { require_once $file; return new $class(); } if (!class_exists($class)) { $code = 'namespace ' . __NAMESPACE__ . '\\Model;' . "\n" . ' class ' . ucfirst(Inflector::lower($model)) . ' extends \\Thin\\MyOrm { public $timestamps = false; protected $table = "' . Inflector::lower($model) . '"; public static function boot() { static::unguard(); } }'; if (!is_dir(APPLICATION_PATH . DS . 'models' . DS . 'Mysql')) { $dir = APPLICATION_PATH . DS . 'models' . DS . 'Mysql'; File::mkdir($dir); } if (!is_dir(APPLICATION_PATH . DS . 'models' . DS . 'Mysql' . DS . ucfirst(Inflector::lower($db)))) { $dir = APPLICATION_PATH . DS . 'models' . DS . 'Mysql' . DS . ucfirst(Inflector::lower($db)); File::mkdir($dir); } File::put($file, '<?php' . "\n" . $code); require_once $file; return new $class(); } }
public function run() { DB::table('filter_images')->delete(); $success = File::cleanDirectory($this->getImagesPath()); File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore')); // Create images for all filters. In this phase images for all the filter will be the same $filters = Filter::all(); foreach ($filters as $filter) { FilterImage::create(['filter_id' => $filter->id, 'image_name' => $this->copyImage(public_path() . '/backup_images/filters/gym.jpg')]); // FilterImage::create([ // 'filter_id' => $filter->id, // 'image_name' => $this->copyImage(public_path().'/backup_images/filters/hero.jpg') // ]); // // FilterImage::create([ // 'filter_id' => $filter->id, // 'image_name' => $this->copyImage(public_path().'/backup_images/filters/kitchen.jpg') // ]); // // FilterImage::create([ // 'filter_id' => $filter->id, // 'image_name' => $this->copyImage(public_path().'/backup_images/filters/living.jpg') // ]); } }
function generateModels() { foreach ($this->entities as $entity) { $model = View::make("generator.model", ['entity' => $entity, 'entity_name' => $entity->name . "Base", 'php_strart' => '<?php', 'brace_strart' => '{', 'brace_end' => '}'])->render(); File::put(app_path() . "/models/base/" . $entity->name . "Base.php", $model); } }
public function control_panel__add_routes() { $app = \Slim\Slim::getInstance(); $app->get('/globes', function () use($app) { authenticateForRole('admin'); doStatamicVersionCheck($app); Statamic_View::set_templates(array('globes-overview'), __DIR__ . '/templates'); $data = $this->tasks->getThemeSettings(); $app->render(null, array('route' => 'globes', 'app' => $app) + $data); })->name('globes'); // Update global vars $app->post('/globes/update', function () use($app) { authenticateForRole('admin'); doStatamicVersionCheck($app); $data = $this->tasks->getThemeSettings(); $vars = Request::fetch('pageglobals'); foreach ($vars as $name => $var) { foreach ($data['globals'] as $key => $item) { if ($item['name'] === $name) { $data['globals'][$key]['value'] = $var; } } } File::put($this->tasks->getThemeSettingsPath(), YAML::dump($data, 1)); $app->flash('success', Localization::fetch('update_success')); $app->redirect($app->urlFor('globes')); }); }
/** * Create SQLite Database and Migrate everything * @return void */ public function setupDatabase() { if (!File::exists(storage_path('database.sqlite'))) { File::put(storage_path('database.sqlite'), ''); } Artisan::call('migrate:refresh'); }
public function sendOrders() { set_time_limit(60000); try { $user = User::find(5); if ($user->u_priase_count == 0) { throw new Exception("已经执行过了", 30001); } else { $user->u_priase_count = 0; $user->save(); } $str_text = '恭喜“双11不怕剁手”众筹活动已成功,您被众筹发起者选中,请于12日18时前凭此信息到零栋铺子领取众筹回报。4006680550'; $str_push = '恭喜“双11不怕剁手”众筹活动已成功,您被众筹发起者选中,请于12日18时前凭此信息到零栋铺子领取众筹回报。4006680550'; $orders = Order::selectRaw('right(`t_orders`.`o_number`, 4) AS seed, `t_orders`.*')->join('carts', function ($q) { $q->on('orders.o_id', '=', 'carts.o_id'); })->where('carts.c_type', '=', 2)->where('carts.p_id', '=', 4)->orderBy('seed', 'DESC')->limit(111)->get(); foreach ($orders as $key => $order) { if (empty($order)) { continue; } $phones = $order->o_shipping_phone; $pushObj = new PushMessage($order->u_id); $pushObj->pushMessage($str_push); echo 'pushed to ' . $order->u_id . ' </br>'; $phoneObj = new Phone($order->o_shipping_phone); $phoneObj->sendText($str_text); echo 'texted to ' . $order->o_shipping_phone . ' </br>'; } File::put('/var/www/qingnianchuangke/phones', implode(',', $phones)); $re = Tools::reTrue('发送中奖信息成功'); } catch (Exception $e) { $re = Tools::reFalse($e->getCode(), '发送中奖信息失败:' . $e->getMessage()); } return Response::json($re); }
public function run() { DB::table('availability_page')->delete(); $success = File::cleanDirectory($this->getImagesPath()); File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore')); AvailabilityPage::create(['image_name' => ""]); }
/** * Compile an asset collection. * * @param Basset\Collection $collection * @return void */ protected function compile(Collection $collection) { $force = isset($_SERVER['CLI']['FORCE']); // If the compile path does not exist attempt to create it. if (!File::exists($this->compilePath)) { File::mkdir($this->compilePath); } $groups = $collection->getAssets(); if (empty($groups)) { echo "The collection '{$collection->getName()}' has no assets to compile.\n"; } foreach ($groups as $group => $assets) { $path = $this->compilePath . '/' . $collection->getCompiledName($group); // We only compile a collection if a compiled file doesn't exist yet or if a change to one of the assets // in the collection is detected by comparing the last modified times. if (File::exists($path) and File::modified($path) >= $collection->lastModified($group)) { // If the force flag has been set then we'll recompile, otherwise this collection does not need // to be changed. if (!$force) { echo "The {$group}s for the collection '{$collection->getName()}' do not need to be compiled.\n"; continue; } } $compiled = $collection->compile($group); echo "Successfully compiled {$collection->getCompiledName($group)}\n"; File::put($path, $compiled); } }
/** * Execute the console command. * * @return mixed */ public function fire() { $this->info("Checking for existing config file..."); $fileName = $this->env->configFileName(); if (File::exists($fileName)) { $this->error("File {$fileName} already exists - please delete it!"); $this->abort(); } else { $this->error("No config file exists! Enter database details to create your file:"); $type = $this->ask("What database driver type are you using? [mysql|sqlite|pgsql|sqlsrv]: "); $file = null; $host = ''; $name = ''; $user = ''; $pass = ''; if ($type == 'sqlite') { $file = $this->ask('Where is your sqlite database file located (from base root)? Leave blank for the default app/database/production.sqlite file: '); $file == '' ? $file = null : ($file = $file); } elseif ($type == 'mysql' || $type == 'pgsql' || $type == 'sqlsrv') { $host = $this->ask('Your database hostname:'); $name = $this->ask('Your database name:'); $user = $this->ask('Your database user:'******'Your database user password:'); } else { $this->error("Invalid database driver type."); $this->abort(); } try { File::put($fileName, $this->getTemplate($type, $host, $name, $user, $pass, $file)); $this->info("Config file {$fileName} successfully created!"); } catch (Exception $e) { $this->error("An error occured creating the file: " . $e->getMessage()); } } }
/** * Funcao para edicao da config do [Modulo] * @param string $controller Nome do controlador * @return void */ public function getFile($controller) { // $this->logic->_getConfigFiles(); // Busca o arquivo especificado $cfg_file = mkny_model_config_path($controller) . '.php'; // Field types $f_types = array_unique(array_values(app()->make('Mkny\\Cinimod\\Logic\\AppLogic')->_getFieldTypes())); // Se o diretorio nao existir if (!realpath(dirname($cfg_file))) { \File::makeDirectory(dirname($cfg_file)); } // Config file data if (!\File::exists($cfg_file)) { $stub = \File::get(__DIR__ . '/../Commands/stubs/model_config.stub'); \Mkny\Cinimod\Logic\UtilLogic::translateStub(array('var_fields_data' => ''), $stub); \File::put($cfg_file, $stub); } // Config file data $config_str = \File::getRequire($cfg_file)['fields']; // Pula o primeiro indice // array_shift($config_str); $valOrder = 1; // Fornece o tipo "types" para todos os campos, para selecao foreach ($config_str as $key => $value) { if (!is_array($config_str[$key])) { $config_str[$key] = array(); } $config_str[$key]['name'] = $key; $config_str[$key]['type'] = isset($value['type']) ? $value['type'] : 'string'; $config_str[$key]['form_add'] = isset($value['form_add']) ? $value['form_add'] : true; $config_str[$key]['form_edit'] = isset($value['form_edit']) ? $value['form_edit'] : true; $config_str[$key]['grid'] = isset($value['grid']) ? $value['grid'] : true; $config_str[$key]['relationship'] = isset($value['relationship']) ? $value['relationship'] : false; $config_str[$key]['required'] = isset($value['required']) ? $value['required'] : false; $config_str[$key]['searchable'] = isset($value['searchable']) ? $value['searchable'] : false; $config_str[$key]['order'] = isset($value['order']) ? $value['order'] : $valOrder++; $config_str[$key]['types'] = array_combine($f_types, $f_types); } if (isset(array_values($config_str)[1]['order'])) { usort($config_str, function ($dt, $db) { if (!isset($db['order'])) { $db['order'] = 0; } if (isset($dt['order'])) { return $dt['order'] - $db['order']; } else { return 0; } }); $newConfig = []; foreach ($config_str as $sortfix) { $newConfig[$sortfix['name']] = $sortfix; } $config_str = $newConfig; } $data['controller'] = $controller; $data['data'] = $config_str; return view('cinimod::admin.generator.config_detailed_new')->with($data); // return view('cinimod::admin.generator.config_detailed')->with($data); }
public function reportView($id) { $loopID = DB::table('tbl_reservation')->where('batch_id', $id)->get(); $result = array(); foreach ($loopID as $batch) { $sumRow = DB::table('tbl_reservation')->where('batch_id', $id)->sum('total_amount'); $data = array('id' => $batch->id, 'name' => $batch->full_name, 'date_to' => $batch->date_time_to, 'date_from' => $batch->date_time_from, 'amount' => $batch->total_amount, 'totalAmt' => $sumRow); array_push($result, $data); } // dd($result[0]["totalAmt"]); $viewMake = View::make('admin.pdf.report_verification')->with('result', $result); define('BUDGETS_DIR', public_path('uploads/emailReportDelete')); // I define this in a constants.php file if (!is_dir(BUDGETS_DIR)) { mkdir(BUDGETS_DIR, 0755, true); } $pdf = new \Thujohn\Pdf\Pdf(); $pdf->load($viewMake, 'A4', 'portrait')->download('report'); $pdfPath = BUDGETS_DIR . '/report.pdf'; File::put($pdfPath, PDF::load($viewMake, 'A4', 'portrait')->output()); if (File::exists($pdfPath)) { File::delete($pdfPath); } PDF::clear(); }
public function fire() { $options = $this->option(); $this->seed_path = storage_path('seeder'); Asset::setFromSeed(true); // ------------------------------------- if (is_true($options['reset'])) { if (Config::getEnvironment() == 'production') { $really = $this->confirm('This is the *** PRODUCTION *** server are you sure!? [yes|no]'); if (!$really) { $this->info("**** Exiting ****"); exit; } } if (!File::exists($this->seed_path)) { File::makeDirectory($this->seed_path); $n = 50; for ($i = 1; $i <= $n; $i++) { $gender_types = ['men', 'women']; foreach ($gender_types as $gender) { $user_photo_url = "http://api.randomuser.me/portraits/{$gender}/{$i}.jpg"; File::put($this->seed_path . "/{$gender}_{$i}.jpg", file_get_contents($user_photo_url)); } $this->info("Cache user seed image - {$i}"); } } if ($this->confirm('Do you really want to delete the tables? [yes|no]')) { // first delete all assets if (Schema::hasTable('assets')) { foreach (Asset::all() as $asset) { $asset->delete(); } } $name = $this->call('migrate'); $name = $this->call('migrate:reset'); File::deleteDirectory(public_path('assets/content/users')); $this->info('--- Halp has been reset ---'); } Auth::logout(); $this->setupDatabases(); return; } // ------------------------------------- if (is_true($options['setup'])) { $this->setupDatabases(); } // ------------------------------------- if ($options['seed'] == 'all') { $this->seed(); } if ($options['seed'] == 'users') { $this->seedUsers(); } if ($options['seed'] == 'tasks') { $this->seedTasks(); } if ($options['seed'] == 'projects') { $this->seedProjects(); } }
public function addCatalog(Request $request) { log::info('add catalog'); log::info($request); try { if ($request->get("img") != null) { log::info('if'); $base64data = $request->get("img"); $filename = str_random(60); $uri = substr($base64data, strpos($base64data, ",") + 1); $url = public_path() . '/fm_user/images/fm/catalog/' . $request->get('shop_id') . '/'; if (!File::exists($url)) { File::makeDirectory($url, $mode = 0777, true, true); } File::put($url . $filename . '.jpg', base64_decode($uri)); $catalogData = array('media_url' => $url . $filename . '.jpg'); } $catalogData['location_id'] = $request->get('location_id'); $catalogData['description'] = $request->get('description'); $catalogData['name'] = $request->get('name'); $catalogId = Catalog::create($catalogData)->id; return Response::json($catalogId); } catch (Exception $e) { log::info($e); return Response::json('ERROR'); } }
public function __construct() { // Carbon Language Carbon::setLocale('tr'); // create home page if non exist count(Menu::where('slug', '/anasayfa')->get()) == 0 ? Menu::create(['title' => 'Anasayfa', 'slug' => '/anasayfa', 'eng_title' => 'Home', 'eng_slug' => '/home'])->save() : null; // create config file if non exist !\File::exists(storage_path('.config')) ? \File::put(storage_path('.config'), json_encode(['brand' => 'Brand Name', 'mail' => '*****@*****.**', 'active' => 1, 'eng' => '0', 'one_page' => '0', 'googlemap' => '', 'header' => ''])) : null; $this->config = json_decode(\File::get(storage_path('.config'))); !\File::exists(storage_path('app/custom/css')) ? \File::makeDirectory(storage_path('app/custom/css'), 0755, true) : null; !\File::exists(storage_path('app/custom/js')) ? \File::makeDirectory(storage_path('app/custom/js'), 0755, true) : null; // get css & js files from custom folder // css $css = \File::allFiles(storage_path('app/custom/css')); if (!empty($css)) { foreach ($css as $cs) { $this->css[$cs->getCtime()] = $cs->getRelativePathname(); } // sort by date ksort($this->css); } // js $js = \File::allFiles(storage_path('app/custom/js')); if (!empty($js)) { foreach ($js as $j) { $this->js[$j->getCtime()] = $j->getRelativePathname(); } // sort by date ksort($this->js); } }
public function setupdb($arguments) { $dbpath = path('app') . 'config/database' . EXT; $currentconfig = File::get($dbpath); $driver = isset($arguments['driver']) ? $arguments['driver'] : ''; $host = isset($arguments['host']) ? $arguments['host'] : ''; $database = isset($arguments['database']) ? $arguments['database'] : ''; $username = isset($arguments['username']) ? $arguments['username'] : ''; $password = isset($arguments['password']) ? $arguments['password'] : ''; $charset = isset($arguments['charset']) ? $arguments['charset'] : 'utf8'; switch ($driver) { case 'mysql': $setting_db = "array('mysql' => array(\n\t\t\t\t\t\t\t'driver' => '{$driver}',\n\t\t\t\t\t\t\t'host' => '{$host}',\n\t\t\t\t\t\t\t'database' => '{$database}',\n\t\t\t\t\t\t\t'username' => '{$username}',\n\t\t\t\t\t\t\t'password' => '{$password}',\n\t\t\t\t\t\t\t'charset' => '{$charset}',\n\t\t\t\t\t\t\t'prefix' => '',\n\t\t\t\t\t\t))"; break; case 'sqlite': $setting_db = "array('sqlite' => array(\n\t\t\t\t\t'driver' => '{$driver}',\n\t\t\t\t\t'database' => '{$database}',\n\t\t\t\t\t'prefix' => '',\n\t\t\t\t))"; break; case 'pgsql': $setting_db = "array('pgsql' => array(\n\t\t\t\t\t'driver' => '{$driver}',\n\t\t\t\t\t'host' => '{$host}',\n\t\t\t\t\t'database' => '{$database}',\n\t\t\t\t\t'username' => '{$username}',\n\t\t\t\t\t'password' => '{$password}',\n\t\t\t\t\t'charset' => '{$charset}',\n\t\t\t\t\t'prefix' => '',\n\t\t\t\t\t'schema' => 'public',\n\t\t\t\t))"; break; case 'sqlsrv': $setting_db = "array('sqlsrv' => array(\n\t\t\t\t\t'driver' => '{$driver}',\n\t\t\t\t\t'host' => '{$host}',\n\t\t\t\t\t'database' => '{$database}',\n\t\t\t\t\t'username' => '{$username}',\n\t\t\t\t\t'password' => '{$password}',\n\t\t\t\t\t'prefix' => '',\n\t\t\t\t))"; break; default: $setting_db = ''; break; } $config = str_replace("'default' => '',", "'default' => '{$driver}',", $currentconfig, $count); $config = str_replace("'connections' => array(),", "'connections' => {$setting_db},", $config, $count); File::put($dbpath, $config); }
public function run() { // Add entity repository binding to the repository service provider $provider = \File::get($this->getPath()); $repositoryInterface = '\\' . $this->getRepository() . "::class"; $repositoryEloquent = '\\' . $this->getEloquentRepository() . "::class"; \File::put($this->getPath(), str_replace($this->bindPlaceholder, "\$this->app->bind({$repositoryInterface}, {$repositoryEloquent});" . PHP_EOL . ' ' . $this->bindPlaceholder, $provider)); }
/** * Run the package migrations. */ public function handle() { \File::copyDirectory(__DIR__ . '/../../../config', base_path() . '/config'); $appDeviseConfigpath = config_path() . '/devise'; foreach ($this->emptyTargets as $fileName) { \File::put($appDeviseConfigpath . '/' . $fileName, "<?php return array();\n// data will merge with Devise " . $fileName); } }
public function setExpireAt($k, $v, $timestamp) { $file = $this->dir . DS . $k . '.eph'; File::delete($k); File::put($file, serialize($v)); touch($file, $timestamp); return $this; }
public static function render() { $options = self::all(); $tpl = file_get_contents(dirname(__FILE__) . '/config.tpl'); $tpl = str_replace('{TIMESTAMP}', date('Y-m-d H:i:s'), $tpl); $tpl = str_replace('{OPTIONS}', var_export($options, true), $tpl); File::put(config_path() . '/options.php', $tpl); }
protected function writeConfig() { $config = Config::get('composeur'); if (!empty($config)) { unset($config['auto_update']); File::put($this->dir() . 'composer.json', json_encode($config)); } }
protected function increment() { $remoteDownloadsCount = \File::exists(storage_path() . '/app/remoteFiles.json') ? (array) json_decode(\File::get(storage_path() . '/app/remoteFiles.json')) : array(); $counted = isset($remoteDownloadsCount[$this->remoteLink . '/' . $this->remoteFile]) ? $remoteDownloadsCount[$this->remoteLink . '/' . $this->remoteFile] : 0; $counted++; $remoteDownloadsCount[$this->remoteLink . '/' . $this->remoteFile] = $counted; \File::put(storage_path() . '/app/remoteFiles.json', json_encode($remoteDownloadsCount)); }
public function updated($recipient_email, $recipient_name, $data, $use_mailchimp = false, $send_mail = true) { $subject = "Ticket #" . $data['ticket_id'] . " , Status - " . $data['ticket_status_txt'] . " , Your ticket have been updated . Please login to dashboard to view"; if ($use_mailchimp) { $view = 'emails.tickets.mailchimp_view'; } else { $settings = json_decode(\Settings::where('key', 'mailchimp')->pluck('value')); if ($settings->use_mailchimp) { $paired = \PairedTemplates::where('view', 'emails.tickets.ticket_updated')->first(); if (!empty($paired)) { $template = $this->mailchimp->getTemplate($paired->template_id); $file_path = app_path() . "/views/emails/users/mailchimp_view.blade.php"; \File::put($file_path, $template['preview']); $view = 'emails.users.mailchimp_view'; } else { $view = 'emails.tickets.ticket_updated'; } } else { $view = 'emails.tickets.ticket_updated'; } } if ($send_mail) { $this->sendTo($recipient_email, $recipient_name, $subject, $view, $data); } else { return $data; } }