cleanDirectory() public static method

Empty the specified directory of all files and folders.
public static cleanDirectory ( string $directory ) : boolean
$directory string
return boolean
 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')
         //            ]);
     }
 }
Example #2
0
 public function tearDown()
 {
     parent::tearDown();
     $this->userFileStorage = null;
     File::deleteDirectory($this->tmpDir);
     File::cleanDirectory($this->storageDir);
 }
 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' => ""]);
 }
 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')]);
 }
Example #5
0
 public function store(ContactFormRequest $request)
 {
     \Mail::send('emails.contact', array('firstname' => $request->get('firstname'), 'lastname' => $request->get('lastname'), 'email' => $request->get('email'), 'objet' => $request->get('objet'), 'bodyMessage' => $request->get('message'), 'url' => $request->get('url'), 'file' => $request->get('file'), 'copie' => $request->get('copie')), function ($message) use($request) {
         /*si l'utilisateur a demandé à recevoir une copie du message par mail :*/
         if ($request->copie === 'yes') {
             $message->to($request->email, $request->firstname)->subject('copie de mon message à roadweb');
         }
         $message->from($request->email);
         $message->to('*****@*****.**', 'Equipe Roadweb')->subject($request->objet);
         $message->setReplyTo($request->email);
         /*si l'utilisateur a envoyé une capture d'écran :*/
         if (file_exists($request->file('file'))) {
             $img = $request->file('file');
             if ($img->isValid()) {
                 $path = config('images.contact');
                 $extension = $img->getClientOriginalExtension();
                 $name = 'capture.' . $extension;
                 $img->move($path, $name);
             }
             $file = $path . '/' . $name;
             $message->attach($file);
         }
     });
     $path = config('images.contact');
     \File::cleanDirectory($path);
     return \Redirect::route('contact')->with('message', 'Votre email a bien été envoyé ! L\'équipe Roadweb vous répondra dans les plus brefs délais.');
 }
 public function run()
 {
     DB::table('products_sika')->truncate();
     File::cleanDirectory(public_path('assets/img/products/sika'));
     File::makeDirectory(public_path('assets/img/products/sika/tech-carts'), true, true);
     factory(App\ProductSika::class, 10)->create();
 }
 public function run()
 {
     DB::table('home_page_images')->delete();
     $success = File::cleanDirectory($this->getImagesPath());
     File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore'));
     HomePageImages::create(['image' => $this->copyImage(public_path() . '/backup_images/building/entrance.jpg')]);
     HomePageImages::create(['image' => $this->copyImage(public_path() . '/backup_images/building/hero.jpg')]);
     HomePageImages::create(['image' => $this->copyImage(public_path() . '/backup_images/building/lobby.jpg')]);
 }
Example #8
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  PhotosRequest  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(PhotosRequest $request, $id)
 {
     //
     $imageDir = storage_path('app') . '/img/photos/' . $id;
     \File::cleanDirectory($imageDir);
     \File::deleteDirectory($imageDir);
     Photos::find($id)->delete();
     return \Redirect::back()->with('message', 'Fotoğraf Silindi!');
 }
 public function run()
 {
     DB::table('objects')->delete();
     $success = File::cleanDirectory($this->getImagesPath());
     File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore'));
     Object::create(['name' => '202', 'unit' => '3D', 'bedrooms' => '3BD', 'bathrooms' => '2', 'interior' => '1200', 'exterior' => '1200', 'price' => '$2,050,000', 'common_charges' => '1200', 'taxes' => '$612', 'floor_plan_link' => 'http://adminsage.com/db/54/assets/unitplans/2b.pdf', 'shown' => 1]);
     Object::create(['name' => '203', 'unit' => '4C', 'bedrooms' => '1BD', 'bathrooms' => '1', 'interior' => '700', 'exterior' => '700', 'price' => '$1,685,000', 'common_charges' => '800', 'taxes' => '$480', 'floor_plan_link' => 'http://adminsage.com/db/54/assets/unitplans/3f.pdf', 'shown' => 1]);
     Object::create(['name' => '204', 'unit' => '8B', 'bedrooms' => '2BD', 'bathrooms' => '1', 'interior' => '900', 'exterior' => '900', 'price' => '$1,695,000', 'common_charges' => '2000', 'taxes' => '$483', 'floor_plan_link' => 'http://adminsage.com/db/54/assets/unitplans/4d.pdf', 'shown' => 1]);
 }
Example #10
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $this->call('dump-autoload');
     $this->call('cache:clear');
     // $this->call('migrate:refresh');
     $this->call('db:seed');
     File::cleanDirectory(public_path() . '/uploads');
     file_put_contents(public_path() . '/uploads/.gitignore', "*\n!.gitignore");
 }
 public function run()
 {
     $faker = Faker::create();
     $imgDir = public_path() . DS . 'assets' . DS . 'upload' . DS . 'images';
     if (!File::exists($imgDir)) {
         File::makeDirectory($imgDir, 0755);
     }
     File::cleanDirectory($imgDir, true);
     foreach (range(1, 500) as $index) {
         $dir = $imgDir . DS . $index;
         if (!File::exists($dir)) {
             File::makeDirectory($dir, 0755);
         }
         $width = $faker->numberBetween(800, 1024);
         $height = $faker->numberBetween(800, 1024);
         $orgImg = $faker->image($dir, $width, $height);
         chmod($orgImg, 0755);
         $img = str_replace($dir . DS, '', $orgImg);
         $image = new Imagick($orgImg);
         $dpi = $image->getImageResolution();
         $dpi = $dpi['x'] > $dpi['y'] ? $dpi['x'] : $dpi['y'];
         $size = $image->getImageLength();
         $extension = strtolower($image->getImageFormat());
         //get 5 most used colors from the image
         $color_extractor = new ColorExtractor();
         $myfile = $orgImg;
         $mime_type = $image->getImageMimeType();
         switch ($mime_type) {
             case 'image/jpeg':
                 $palette_obj = $color_extractor->loadJpeg($myfile);
                 break;
             case 'image/png':
                 $palette_obj = $color_extractor->loadPng($myfile);
                 break;
             case 'image/gif':
                 $palette_obj = $color_extractor->loadGif($myfile);
                 break;
         }
         $main_color = '';
         if (is_object($palette_obj)) {
             $arr_palette = $palette_obj->extract(5);
             if (!empty($arr_palette)) {
                 $main_color = strtolower($arr_palette[0]);
                 for ($i = 1; $i < count($arr_palette); $i++) {
                     $main_color .= ',' . strtolower($arr_palette[$i]);
                 }
             }
         }
         //update field main_color from images table
         $image_obj = VIImage::findorFail((int) $index);
         $image_obj->main_color = $main_color;
         $image_obj->save();
         $id = VIImageDetail::insertGetId(['path' => 'assets/upload/images/' . $index . '/' . $img, 'height' => $height, 'width' => $width, 'ratio' => $width / $height, 'dpi' => $dpi, 'size' => $size, 'extension' => $extension, 'type' => 'main', 'image_id' => $index]);
         BackgroundProcess::makeSize($id);
     }
 }
Example #12
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $format = '%s%s';
     $publicPath = public_path();
     $pdfPath = sprintf($format, $publicPath, '/pdfs');
     $descriptionPath = sprintf($format, $publicPath, '/descriptions');
     $activitiesPath = sprintf($format, $publicPath, '/activities');
     File::cleanDirectory($pdfPath);
     File::cleanDirectory($descriptionPath);
     File::cleanDirectory($activitiesPath);
 }
 public function run()
 {
     DB::table('residences')->delete();
     $success = File::cleanDirectory($this->getImagesPath());
     File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore'));
     Residence::create(['name' => 'Living room', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/residences/living.jpg'), 'order_id' => 2]);
     Residence::create(['name' => 'Kitchen', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/residences/kitchen.jpg'), 'order_id' => 1]);
     Residence::create(['name' => 'Bedroom', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/residences/bedroom.jpg'), 'order_id' => 1]);
     Residence::create(['name' => 'Bath', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/residences/bath.jpg'), 'order_id' => 3]);
     Residence::create(['name' => 'Penthouse', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/residences/penthouse.jpg'), 'order_id' => 3]);
 }
 public function run()
 {
     DB::table('amenities')->delete();
     $success = File::cleanDirectory($this->getImagesPath());
     File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore'));
     Amenitie::create(['name' => 'Lobby', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/amenities/lobby.jpg'), 'order_id' => 1]);
     Amenitie::create(['name' => 'Lounge', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/amenities/lounge.jpg'), 'order_id' => 2]);
     Amenitie::create(['name' => 'Terrace', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/amenities/terrace.jpg'), 'order_id' => 3]);
     Amenitie::create(['name' => 'Children\'s Playroom', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/amenities/childrens_playroom.jpg')]);
     Amenitie::create(['name' => 'Other amenities', 'text' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin finibus congue pellentesque. Vestibulum euismod non dolor eget malesuada. Fusce fringilla non nunc ac eleifend. Aliquamauctor cursus lectus sit amet vulputate.', 'image_name' => $this->copyImage(public_path() . '/backup_images/amenities/other_amenities.jpg')]);
 }
 public function run()
 {
     DB::table('filters')->delete();
     $success = File::cleanDirectory($this->getImagesPath());
     File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore'));
     Filter::create(['name' => 'Fitness', 'poi_url' => 'http://happyfist.co/pois/pois/POI/gyms.kml', 'text' => 'lorem', 'paragraph_title' => 'ipsum']);
     Filter::create(['name' => 'Lodging', 'poi_url' => 'http://happyfist.co/pois/pois/POI/hotels.kml', 'text' => 'lorem', 'paragraph_title' => 'ipsum']);
     Filter::create(['name' => 'Culture', 'poi_url' => 'http://happyfist.co/pois/pois/POI/artMuseums.kml', 'text' => 'lorem', 'paragraph_title' => 'ipsum']);
     Filter::create(['name' => 'Entertainment', 'poi_url' => 'http://happyfist.co/pois/pois/POI/nightlife.kml', 'text' => 'lorem', 'paragraph_title' => 'ipsum']);
     Filter::create(['name' => 'Dinning', 'poi_url' => 'http://happyfist.co/pois/pois/POI/restaurants.kml', 'text' => 'lorem', 'paragraph_title' => 'ipsum']);
     Filter::create(['name' => 'Education', 'poi_url' => 'http://happyfist.co/pois/pois/POI/schools.kml', 'text' => 'lorem', 'paragraph_title' => 'ipsum']);
     Filter::create(['name' => 'Retail', 'poi_url' => 'http://happyfist.co/pois/pois/POI/shop-and-specialities.kml', 'text' => 'lorem', 'paragraph_title' => 'ipsum']);
     Filter::create(['name' => 'Transportation', 'poi_url' => 'http://happyfist.co/pois/pois/POI/transit.kml', 'text' => 'lorem', 'paragraph_title' => 'ipsum']);
 }
Example #16
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     if ($this->how == 'single') {
         $imageDir = storage_path('app') . '/img/photos/' . $this->model->id;
         \File::cleanDirectory($imageDir);
         \File::deleteDirectory($imageDir);
     } else {
         foreach ($this->model->photos as $photo) {
             $imageDir = storage_path('app') . '/img/photos/' . $photo->id;
             \File::cleanDirectory($imageDir);
             \File::deleteDirectory($imageDir);
             $photo->delete();
         }
     }
 }
 public function getRemoveCache()
 {
     File::cleanDirectory(public_path() . '/cache');
     File::cleanDirectory(storage_path() . '/cache');
     File::cleanDirectory(storage_path() . '/views');
     Cache::forget('siteName');
     Cache::forget('description');
     Cache::forget('favIcon');
     Cache::forget('faq');
     Cache::forget('privacy');
     Cache::forget('tos');
     Cache::forget('featuredImage');
     Cache::forget('featuredAuthor');
     return Redirect::to('admin')->with('flashSuccess', 'All cached files are deleted');
 }
Example #18
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     zbase_maintenance_set();
     zbase()->setConsoleCommand($this);
     $phpCommand = env('ZBASE_PHP_COMMAND', 'php');
     $packages = zbase()->packages();
     if (!empty($packages)) {
         foreach ($packages as $packageName) {
             $zbase = zbase_package($packageName);
             if ($zbase instanceof Interfaces\MigrateCommandInterface) {
                 $this->info($this->signature . '.pre - ' . $packageName);
                 $zbase->migrateCommand($phpCommand, ['migrate.pre' => true, 'command' => $this]);
             }
         }
     }
     \File::cleanDirectory(database_path() . '/migrations');
     \File::cleanDirectory(database_path() . '/seeds');
     \File::cleanDirectory(database_path() . '/factories');
     \File::cleanDirectory(storage_path() . '/zbase');
     \File::cleanDirectory(storage_path() . '/framework/cache');
     \File::cleanDirectory(storage_path() . '/framework/views');
     \File::cleanDirectory(storage_path() . '/logs');
     echo shell_exec($phpCommand . ' artisan vendor:publish --tag=migrations --force');
     echo shell_exec($phpCommand . ' artisan optimize');
     echo shell_exec($phpCommand . ' artisan migrate:refresh --seed --force');
     $commands = [];
     // zbase()->commands('migrate');
     if (!empty($commands)) {
         foreach ($commands as $command) {
             if ($command instanceof \Closure) {
                 $command();
             } else {
                 echo shell_exec($phpCommand . ' artisan ' . $command);
             }
         }
     }
     if (!empty($packages)) {
         foreach ($packages as $packageName) {
             $zbase = zbase_package($packageName);
             if ($zbase instanceof Interfaces\MigrateCommandInterface) {
                 $this->info($this->signature . '.post - ' . $packageName);
                 $zbase->migrateCommand($phpCommand, ['migrate.post' => true, 'command' => $this]);
             }
         }
     }
     zbase_maintenance_unset();
 }
Example #19
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     zbase()->setConsoleCommand($this);
     $phpCommand = env('ZBASE_PHP_COMMAND', 'php');
     $packages = zbase()->packages();
     if (!empty($packages)) {
         foreach ($packages as $packageName) {
             $zbase = zbase_package($packageName);
             if ($zbase instanceof Interfaces\ClearCommandInterface) {
                 $this->info($this->signature . '.pre - ' . $packageName);
                 $zbase->clearCommand($phpCommand, ['clear.pre' => true, 'command' => $this]);
             }
         }
     }
     echo shell_exec($phpCommand . ' artisan clear-compiled');
     echo shell_exec($phpCommand . ' artisan cache:clear');
     echo shell_exec($phpCommand . ' artisan view:clear');
     echo shell_exec($phpCommand . ' artisan config:clear');
     echo shell_exec($phpCommand . ' artisan route:clear');
     \File::cleanDirectory(zbase_storage_path('tmp/images'));
     \File::cleanDirectory(zbase_storage_path(zbase_tag() . '_tmp/images'));
     $commands = [];
     // zbase()->commands('clear');
     if (!empty($commands)) {
         foreach ($commands as $command) {
             if ($command instanceof \Closure) {
                 $command();
             } else {
                 echo shell_exec($phpCommand . ' artisan ' . $command);
             }
         }
     }
     if (!empty($packages)) {
         foreach ($packages as $packageName) {
             $zbase = zbase_package($packageName);
             if ($zbase instanceof Interfaces\ClearCommandInterface) {
                 $this->info($this->signature . '.post - ' . $packageName);
                 $zbase->clearCommand($phpCommand, ['clear.post' => true, 'command' => $this]);
             }
         }
     }
 }
 /**
  * NOSH ChartingSystem Backup and Updating System, to be run as a cron job
  */
 public function backup()
 {
     $config_file = __DIR__ . "/../../.env.php";
     $config = (require $config_file);
     $row2 = Practiceinfo::find(1);
     $dir = $row2->documents_dir;
     $file = $dir . "noshbackup_" . time() . ".sql";
     $command = "mysqldump -u " . $config['mysql_username'] . " -p" . $config['mysql_password'] . " " . $config['mysql_database'] . " > " . $file;
     system($command);
     $files = glob($dir . "*.sql");
     foreach ($files as $file_row) {
         $explode = explode("_", $file_row);
         $time = intval(str_replace(".sql", "", $explode[1]));
         $month = time() - 604800;
         if ($time < $month) {
             unlink($file_row);
         }
     }
     DB::delete('delete from extensions_log where DATE_SUB(CURDATE(), INTERVAL 30 DAY) >= timestamp');
     File::cleanDirectory(__DIR__ . "/../../public/temp");
 }
Example #21
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  AdminRequest  $request
  * @return \Illuminate\Http\Response
  */
 public function store(AdminRequest $request)
 {
     $config['brand'] = \Input::get('brand');
     $config['mail'] = \Input::get('mail');
     $config['active'] = \Input::get('active');
     $config['eng'] = \Input::get('eng');
     $config['one_page'] = \Input::get('one_page');
     $config['googlemap'] = \Input::get('googlemap');
     $config['header'] = \Input::get('header');
     if (\Input::file('ico')) {
         \File::copy(\Input::file('ico'), public_path('favicon.ico'));
     }
     \File::put(storage_path('.config'), json_encode($config));
     $custom_js = \Input::file('custom_js');
     $custom_css = \Input::file('custom_css');
     $custom_css ? $custom_css->move(storage_path('app/custom/css'), \trslug::trslug(pathinfo($custom_css->getClientOriginalName(), PATHINFO_FILENAME)) . '.css') : null;
     $custom_js ? $custom_js->move(storage_path('app/custom/js'), \trslug::trslug(pathinfo($custom_js->getClientOriginalName(), PATHINFO_FILENAME)) . '.js') : null;
     if (\Input::file('logo')) {
         \File::cleanDirectory(storage_path('app/img/.cache'));
         \Intervention::make(\Input::file('logo'))->save(storage_path('app/img/assets/logo.png'));
     }
     \Activity::log('Admin Anasayfa Güncellendi');
     return \Redirect::back()->with('message', 'Kaydedildi!');
 }
 public function removeAssets()
 {
     $pasta = base_path() . "/resources/views/themes/linexti/assets/";
     if (\File::isDirectory($pasta)) {
         $success = \File::cleanDirectory($pasta);
         if ($success) {
             return 'sucesso';
         }
     } else {
         return 'diretoriovazio';
     }
 }
 /**
  * Clean the uploads folder
  */
 protected function cleanFolder()
 {
     File::cleanDirectory($this->uploadsfolder);
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     File::cleanDirectory('uploads/posts');
     Schema::drop('posts');
 }
Example #25
0
<?php

/**
 * This file is only loaded under the local environment
 * useful for debugging or testing out new features
 * before moving it to the production environment
 */
View::share('localroute', true);
Route::get('/reset', function () {
    Artisan::call('db:seed');
    File::cleanDirectory(public_path() . '/uploads');
    file_put_contents(public_path() . '/uploads/.gitignore', "*\n!.gitignore\n!index.html");
    touch(public_path() . '/uploads/index.html');
    return Redirect::action('AuthController@login');
});
Route::get('/report-builder', function () {
    $roles = Auth::user()->roles();
    return json_encode($roles->getQuery());
});
Route::resource('report-builder', 'ReportsController');
Route::resource('report-builder.fields', 'ReportFieldsController');
Route::resource('report-builder.eagers', 'ReportEagersController');
Route::resource('report-builder.groupings', 'ReportGroupingsController');
Route::resource('report-builder.columns', 'ReportColumnsController');
Example #26
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     File::cleanDirectory(storage_path() . '/app');
     // Logistics
     $logistics = Logistics::create(array('logistics_name' => 'Free Shipping', 'status' => 'enabled', 'logistics_desc' => 'Free Shipping', 'deliverer_name' => '\\App\\Plugins\\Offical\\Deliverers\\Simple', 'deliverer_settings' => array('effective' => '1-2 days', 'price' => 0), 'deliverer_cod' => array()));
     $payment = Payment::create(array('payment_name' => 'Paypal', 'status' => 'enabled', 'payment_desc' => 'Paypal', 'gateway_name' => '\\App\\Plugins\\Offical\\Payments\\Paypal\\Main', 'gateway_settings' => array('username' => 'garbinh-facilitator_api1.gmail.com', 'password' => '35RQL3NH8CN5JAFS', 'signature' => 'An5ns1Kso7MWUdW4ErQKJJJ4qi4-ASi8mA4dnxkI-AikSA9AZVvSERfE')));
     $models = $this->createProduct(['product_name' => 'Tesla Model S', 'status' => 'available', 'product_desc' => '', 'options' => array(['name' => 'Paint', 'options' => ['Solid Black', 'Solid White', 'Red']], ['name' => 'Roof', 'options' => ['Body Color Roof', 'Glass Roof']], ['name' => 'Battery', 'options' => ['70D', '85D', 'P85D']]), 'specifications' => []], ['dir' => 'models', 'files' => File::files(database_path() . '/seeds/demo/models')], ['70d' => ['option' => ['Solid Black', 'Body Color Roof', '70D'], 'price' => 75000, 'cover' => 'black.png'], '85d' => ['option' => ['Solid White', 'Body Color Roof', '85D'], 'price' => 85000, 'cover' => 'white.png'], 'p85d' => ['option' => ['Red', 'Glass Roof', 'P85D'], 'price' => 108000, 'cover' => 'red.png']]);
     $watch = $this->createProduct(['product_name' => 'Apple Watch', 'status' => 'available', 'product_desc' => '', 'options' => array(['name' => 'Size', 'options' => ['38mm', '48mm']], ['name' => 'Case', 'options' => ['Silver Aluminum', 'Stainless Steel']], ['name' => 'Band', 'options' => ['White Sport Band', 'Black Sport Band', 'Black Classic Buckle', 'Milanese Loop', 'Black Modern Buckle', 'Link Bracelet']]), 'specifications' => []], ['dir' => 'watch', 'files' => File::files(database_path() . '/seeds/demo/watch')], [['option' => ['38mm', 'Stainless Steel', 'White Sport Band'], 'price' => 549, 'cover' => 'w38ss-sbwh-sel.jpg'], ['option' => ['42mm', 'Stainless Steel', 'Black Sport Band'], 'price' => 599, 'cover' => 'w42ss-sbbk-sel.jpg'], ['option' => ['38mm', 'Stainless Steel', 'Black Classic Buckle'], 'price' => 649, 'cover' => 'w38ss-cbbk-sel.jpg'], ['option' => ['42mm', 'Stainless Steel', 'Milanese Loop'], 'price' => 699, 'cover' => 'w42ss-ml-sel_GEO_US.jpg'], ['option' => ['38mm', 'Stainless Steel', 'Black Modern Buckle'], 'price' => 749, 'cover' => 'w38ss-mbbk-sel.jpg'], ['option' => ['42mm', 'Stainless Steel', 'Link Bracelet'], 'price' => 999, 'cover' => 'w42ss-slsi-sel.jpg']]);
     $files = [];
     foreach (File::files(database_path() . '/seeds/demo/pages') as $path) {
         $filename = basename($path);
         $files[$filename] = UploadFile::create(array('file' => (string) Image::make($path)->encode('data-url'), 'file_name' => $filename));
     }
     Page::create(['title' => 'Index', 'pathname' => 'index', 'position' => 'index', 'settings' => ['widgets' => [['widget' => 'Offical.Slider', 'style' => ['padding' => '0px'], 'data' => ['<div class="slide-item" style="background-image:url(' . $files['slider.models.jpg']->file_path . ');background-size:cover;">
                             <div style="position:relative;left:50%;width:50%;height:100%;">
                                 <div style="position: relative;top: 10%;left: -50%;width: 100%;">
                                     <h1>
                                         TESLA&reg; Model S
                                     </h1>
                                     <p class="lead">
                                         Highest safety rating in America<br />
                                         Autopilot equipped<br />
                                         Available All-Wheel Drive Dual Motor<br />
                                         Zero to 60 mph in as little as 2.8 seconds<br />
                                         Up to 270 miles range (EPA)<br />
                                         <a href="/models">Learn More</a>
                                     </p>
                                 </div>
                             </div>
                         </div>', '<div class="slide-item" style="background-image:url(' . $files['slider.watch.png']->file_path . ');background-size:692px 224px;">
                             <div style="position:relative;left:50%;width:50%;height:100%;">
                                 <div style="text-align:center; position: relative;top: 10%;left: -50%;width: 100%;">
                                     <h1 style="font-size:4em;"><i class="ion-social-apple"></i>&nbsp;WATCH</h1>
                                     <p class="lead" style="font-size:2em">The Watch is <a href="/watch">here</a></p>
                                 </div>
                             </div>
                         </div>']]]]]);
     Page::create(['title' => 'Buy Models', 'pathname' => 'models/buy', 'position' => 'models', 'settings' => ['button' => ['className' => 'btn btn-primary btn-sm', 'text' => 'Buy Now'], 'widgets' => [['widget' => 'Offical.Header', 'id' => '#models_header', 'data' => ['title' => '<a href="/models">TESLA Model S</a>', 'position' => 'models']], ['widget' => 'Offical.ProductPicker', 'data' => ['product_id' => 1]], ['widget' => 'Offical.PureHTML', 'style' => ['background' => 'whitesmoke'], 'data' => '<div class="container text-center" style="width:65%">
                                     <div>
                                     <h1>Battery, Performance, and Drive options</h1>
                                     <p class="lead">Every Model S includes free long distance travel using Tesla\'s Supercharger network and an eight year, infinite mile battery and drive warranty.</p>
                                     </div>
                                     <div class="row">
                                         <div class="col-xs-4">
                                             <div style="background-color:white;border:1px solid #cccccc;text-align:left;height:400px;">
                                                 <h1 class="text-center"><span style="color:#aaa;">70</span><strong>D</strong></h1>
                                                 <ol style="list-style:none;padding:15px;">
                                                     <li style="text-align: center;margin-top: -20px;padding-bottom: 20px;border-bottom: 1px solid #ccc;margin-bottom: 20px;"><strong>All-Wheel Drive</strong></li>
                                                     <li class="package-detail">70 kWh battery with all-wheel drive</li>
                                                     <li class="package-detail"><strong>240</strong> miles range (EPA)</li>
                                                     <li class="package-detail"><strong>5.2</strong> seconds 0-60 mph</li>
                                                     <li class="package-detail"><strong>13.5</strong> seconds ¼ mile</li>
                                                     <li class="package-detail"><strong>328</strong> hp<br>
                                                     <strong>259</strong> hp front and rear motor power</li>
                                                     <li class="package-detail"><strong>387</strong> lb-ft motor torque</li>
                                                     <li class="package-detail"><strong>140</strong> mph top speed</li>
                                                 </ol>
                                             </div>
                                         </div>
                                         <div class="col-xs-4">
                                             <div style="background-color:white;border:1px solid #cccccc;text-align:left;height:400px;">
                                                 <h1 class="text-center"><span style="color:#aaa;">85</span><strong>D</strong></h1>
                                                 <ol style="list-style:none;padding:15px;">
                                                     <li style="text-align: center;margin-top: -20px;padding-bottom: 20px;border-bottom: 1px solid #ccc;margin-bottom: 20px;"><strong>All-Wheel Drive</strong></li>
                                                     <li>85 kWh battery with all-wheel drive<br>
                                                     90 kWh upgrade increases range 6%</li>
                                                     <li><strong>270</strong> miles range (EPA)</li>
                                                     <li><strong>4.2</strong> seconds 0-60 mph</li>
                                                     <li><strong>12.5</strong> seconds ¼ mile</li>
                                                     <li><strong>417</strong> hp <br>
                                                     <strong>259</strong> hp front and rear motor power</li>
                                                     <li><strong>485</strong> lb-ft motor torque</li>
                                                     <li><strong>155</strong> mph top speed</li>
                                                 </ol>
                                             </div>
                                         </div>
                                         <div class="col-xs-4">
                                             <div style="background-color:white;border:1px solid #cccccc;text-align:left;height:400px;">
                                                 <h1 class="text-center"><span style="color:red;font-weight:bold;">P</span><span style="color:#aaa;">85</span><strong style="color:red;">D</strong></h1>
                                                 <ol style="list-style:none;padding:15px;">
                                                     <li style="text-align: center;margin-top: -20px;padding-bottom: 20px;border-bottom: 1px solid #ccc;margin-bottom: 20px;"><strong>Performance All-Wheel Drive</strong></li>
                                                     <li>85 kWh battery with all-wheel drive<br>
                                                     90 kWh upgrade increases range 6%</li>
                                                     <li><strong>253</strong> miles range (EPA)</li>
                                                     <li><strong>3.1</strong> seconds 0-60 mph<br>
                                                     <strong>2.8</strong> seconds 0-60 mph with Ludicrous Speed Upgrade</li>
                                                     <li><strong>10.9</strong> seconds ¼ mile with Ludicrous Speed Upgrade</li>
                                                     <li><strong>259</strong> hp front motor power <br>
                                                     <strong>503</strong> hp rear motor power</li>
                                                     <li><strong>713</strong> lb-ft motor torque</li>
                                                     <li><strong>155</strong> mph top speed</li>
                                                 </ol>
                                             </div>
                                         </div>
                                     </div>
                                  </div>']]]]);
     Page::create(['title' => 'Model S', 'pathname' => 'models', 'position' => 'nav', 'settings' => ['effect' => ['name' => 'scrollmagic', 'pins' => [['element' => '#models_header', 'scene' => ['offset' => 50], 'settings' => ['pushFollowers' => false]]]], 'widgets' => [['widget' => 'Offical.Header', 'id' => 'models_header', 'data' => ['title' => 'TESLA Model S', 'position' => 'models']], ['style' => ['padding' => '0px', 'marginTop' => '-50px'], 'widget' => 'Offical.PureHTML', 'data' => '<div style="height:674px; background-image:url(' . $files['models.section.jpg']->file_path . ');background-size:cover;">
                                     <div style="position:relative;left:50%;width:50%;height:100%;">
                                         <div style="position: relative;top: 15%;left: -50%; color:white; width: 100%; text-align:right">
                                             <p class="lead" style="font-size:1.5em">
                                                 Highest safety rating in America<br />
                                                 Autopilot equipped<br />
                                                 Available All-Wheel Drive Dual Motor<br />
                                                 Zero to 60 mph in as little as 2.8 seconds<br />
                                                 Up to 270 miles range (EPA)
                                             </p>
                                         </div>
                                     </div>
                                 </div>'], ['widget' => 'Offical.PureHTML', 'data' => '<div class="text-center container" style="width:55%">
                                     <h1>Zero Emissions. Zero Compromises.</h1>
                                     <p class="lead" style="font-size:1.2em">
                                         Tesla’s advanced electric powertrain delivers exhilarating performance. Unlike a gasoline internal combustion engine with hundreds of moving parts, Tesla electric motors have only one moving piece: the rotor. As a result, Model S acceleration is instantaneous, silent and smooth. Step on the accelerator and in as little as 2.8 seconds Model S is travelling 60 miles per hour, without hesitation, and without a drop of gasoline. Model S is an evolution in automobile engineering.
                                     </p>
                                 </div>'], ['widget' => 'Offical.PureHTML', 'style' => ['background' => 'white'], 'data' => '<div class="text-center">
                                     <figure>
                                         <video type="video/mp4" src="http://www.teslamotors.com/sites/default/files/images/model-s/videos/powertrain-dualmotor-p85d.mp4" class="media-element media-video" autoplay="" loop=""></video>
                                     </figure>
                                     <div class="container" style="width:55%">
                                         <h1>All-Wheel Drive Dual Motor</h1>
                                         <p class="lead">
                                             Dual Motor Model S is a categorical improvement on conventional all-wheel drive systems. With two motors, one in the front and one in the rear, Model S digitally and independently controls torque to the front and rear wheels. The result is unparalleled traction control in all conditions.
                                         </p>
                                     </div>
                                 </div>'], ['widget' => 'Offical.ImageParkText', 'style' => ['background' => 'whitesmoke'], 'data' => ['text' => ['title' => 'Zero profile door handles', 'subtitle' => 'Model S door handles are a work of art. When a key is in close proximity, they automatically extend. When no longer in use, they retract into the body of the car, creating a seamless surface for air to pass over.'], 'img' => ['src' => $files['models.door-handles-black.jpg']->file_path]]], ['widget' => 'Offical.ImageParkText', 'style' => ['background' => 'white'], 'data' => ['text' => ['title' => 'Hidden in plain sight', 'subtitle' => 'Scan the streamlined body panels and you\'ll discover that Model S lacks a fuel door. Approach the driver\'s side taillight with a charging connector and the hidden charge port automatically opens. The charging connector cannot be removed until Model S is unlocked.'], 'img' => ['src' => $files['models.charging-default.jpg']->file_path]]], ['widget' => 'Offical.Slider', 'style' => ['padding' => '0px'], 'settings' => ['indicators' => false, 'className' => 'carousel-fade'], 'data' => ['<figure>
                             <img src="' . $files['models.gallery.1.jpg']->file_path . '" />
                          </figure>', '<figure>
                             <img src="' . $files['models.gallery.2.jpg']->file_path . '" />
                          </figure>', '<figure>
                             <img src="' . $files['models.gallery.3.jpg']->file_path . '" />
                          </figure>', '<figure>
                             <img src="' . $files['models.gallery.4.jpg']->file_path . '" />
                          </figure>', '<figure>
                             <img src="' . $files['models.gallery.5.jpg']->file_path . '" />
                          </figure>', '<figure>
                             <img src="' . $files['models.gallery.6.jpg']->file_path . '" />
                          </figure>', '<figure>
                             <img src="' . $files['models.gallery.7.jpg']->file_path . '" />
                          </figure>', '<figure>
                             <img src="' . $files['models.gallery.8.jpg']->file_path . '" />
                          </figure>', '<figure>
                             <img src="' . $files['models.gallery.9.jpg']->file_path . '" />
                          </figure>']], ['widget' => 'Offical.ImageParkText', 'style' => ['background' => 'whitesmoke'], 'data' => ['text' => ['title' => 'Exquisite materials', 'subtitle' => 'Every surface, seam, and stitch is a carefully considered balance between tactile, visual, and environmental friendliness. Door handles are made from hand polished zinc, the leather trim uses premium Nappa leather, and décor pieces are minimally finished to preserve their natural beauty. Materials are sourced as close to our California factory as possible to reduce the environmental impact of transporting them long distances.'], 'img' => ['src' => $files['models.obeche-matte-yacht-floor.jpg']->file_path]]], ['widget' => 'Offical.ImageParkText', 'style' => ['background' => 'white'], 'data' => ['text' => ['title' => 'The touchscreen', 'subtitle' => 'The Model S 17 inch touchscreen controls most of the car\'s functions. Opening the all glass panoramic roof, customizing the automatic climate control, and changing the radio station all happen with a swipe or a touch. The touchscreen, digital instrument cluster, and steering wheel controls seamlessly integrate media, navigation, communications, cabin controls and vehicle data.'], 'img' => '<iframe src="//player.vimeo.com/video/61821553" width="430" height="240" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>']], ['widget' => 'Offical.PureHTML', 'style' => ['background' => 'whitesmoke'], 'data' => '<div class="container text-center">
                                     <a href="/models/buy" class="btn btn-lg btn-danger">GET YOUR MODEL S NOW</a>
                                 </div>']]]]);
     Page::create(['title' => 'Buy Watch', 'pathname' => 'watch/buy', 'position' => 'watch', 'settings' => ['button' => ['className' => 'btn btn-primary btn-sm', 'text' => 'Buy'], 'effect' => ['name' => 'scrollmagic', 'pins' => [['element' => '#watch_header', 'scene' => ['offset' => 50], 'settings' => ['pushFollowers' => false]]]], 'widgets' => [['widget' => 'Offical.Header', 'id' => 'watch_header', 'data' => ['title' => '<a href="/watch"><i class="ion-social-apple"></i>&nbsp;WATCH</a>', 'position' => 'watch']], ['widget' => 'Offical.ProductSelector', 'data' => ['product_id' => 2, 'title' => '<i class="ion-social-apple"></i>&nbsp;WATCH', 'template' => '${option[0]} ${option[1]} Case with ${option[2]}']], ['widget' => 'Offical.ImageParkText', 'style' => ['background' => 'white', 'padding' => '0px', 'borderTop' => '1px solid #ccc'], 'data' => ['text' => ['title' => 'Stainless steel case.', 'subtitle' => 'The case is crafted from a refined 316L stainless steel that’s been cold forged, making it up to 80 percent harder. It’s less susceptible to nicks and corrosion and has a beautiful mirror finish.'], 'img' => ['src' => $files['watch.watch-case-bb-201504a.jpeg']->file_path]]], ['widget' => 'Offical.ImageParkText', 'style' => ['background' => 'white', 'padding' => '0px', 'borderTop' => '1px solid #ccc'], 'data' => ['text' => ['title' => 'Sapphire crystal display.', 'subtitle' => 'The display is protected by ultra-hard, polished, precision-machined sapphire crystal.'], 'img' => ['src' => $files['watch.watch-display-bb-201504a.jpeg']->file_path]]], ['widget' => 'Offical.ImageParkText', 'style' => ['background' => 'white', 'padding' => '0px', 'borderTop' => '1px solid #ccc'], 'data' => ['text' => ['title' => 'Fine leather, durable fluoroelastomer, and polished stainless steel bands.', 'subtitle' => 'Choose from three different leather bands, a high-performance fluoroelastomer band, a link bracelet, and a Milanese loop.'], 'img' => '<img src="' . $files['watch.watch-band-static-bb-201504a.jpeg']->file_path . '" style="max-height:575px" />']]]]]);
     Page::create(['title' => 'Watch', 'pathname' => 'watch', 'position' => 'nav', 'settings' => ['widgets' => [['widget' => 'Offical.Header', 'id' => 'watch_header', 'style' => ['background' => 'transparent', 'color' => '#fff', 'fontWeight' => 'bold'], 'data' => ['title' => '<i class="ion-social-apple"></i>&nbsp;WATCH', 'position' => 'watch']], ['widget' => 'Offical.Slider', 'style' => ['padding' => '0px', 'marginTop' => '-50px'], 'settings' => ['indicators' => false, 'className' => 'carousel-fade', 'controls' => false, 'pauseOnHover' => false], 'data' => ['<div style="position:relative;">
                             <div style="position:absolute; top:15%; width:100%; left:0; text-align:center; font-size: 4em; font-weight:100; color:white">
                                 Notifications. Activity. Siri. Apple Pay.
                                 <br />Right on your wrist.
                             </div>
                             <figure>
                                 <img src="' . $files['watch.hero_dance_large_2x.jpg']->file_path . '" />
                             </figure>
                         </div>', '<div style="position:relative;">
                             <div style="position:absolute; top:15%; width:100%; left:0; text-align:center; font-size: 4em; font-weight:100; color:white">
                                 Notifications. Activity. Siri. Apple Pay.
                                 <br />Right on your wrist.
                             </div>
                             <figure>
                                 <img src="' . $files['watch.hero_sunset_large_2x.jpg']->file_path . '" />
                             </figure>
                         </div>', '<div style="position:relative;">
                             <div style="position:absolute; top:15%; width:100%; left:0; text-align:center; font-size: 4em; font-weight:100; color:white">
                                 Notifications. Activity. Siri. Apple Pay.
                                 <br />Right on your wrist.
                             </div>
                             <figure>
                                 <img src="' . $files['watch.hero_kiss_large_2x.jpg']->file_path . '" />
                             </figure>
                         </div>']], ['widget' => 'Offical.PureHTML', 'style' => ['padding' => '0px'], 'data' => '<div style="background:#f2f2f2">
                                 <div class="container text-center">
                                     <h1>Our most personal device yet.</h1>
                                     <p class="lead" style="width:60%;margin:auto">To make the best use of its size and location on your wrist, Apple Watch has all-new interactions and technologies. They let you do familiar things more quickly and conveniently. As well as some things that simply weren’t possible before. So using it is a whole new experience. One that’s more personal than ever.</p>
                                 </div>
                                 <figure>
                                 <img src="' . $files['watch.technology_hero_large_2x.jpg']->file_path . '" />
                                 </figure>
                                </div>'], ['widget' => 'Offical.PureHTML', 'style' => ['background' => 'white', 'padding' => '0px'], 'data' => '<div style="overflow:hidden;">
                                 <div class="container text-center">
                                     <h1>An incredibly precise timepiece.</h1>
                                     <p class="lead" style="width:60%;margin:auto">High-quality watches have long been defined by their ability to keep unfailingly accurate time, and Apple Watch is no exception. In conjunction with your iPhone, it keeps time within 50 milliseconds of the definitive global time standard. It even lets you customize your watch face to present time in a more meaningful, personal context that’s relevant to your life and schedule.</p>
                                 </div>
                                 <figure style="position:relative; margin-top:30px; margin-bottom:-500px; width:711px; height:898px; margin-left:auto; margin-right:auto; background-image:url(' . $files['watch.timekeeping_hero_large_2x.jpg']->file_path . '); background-size:711px 898px;">
                                 </figure>
                                </div>'], ['widget' => 'Offical.PureHTML', 'style' => ['padding' => '0px'], 'data' => '<div style="background:#f2f2f2">
                                 <div class="container text-center">
                                     <h1>Entirely new ways to stay in touch.</h1>
                                     <p class="lead" style="width:60%;margin:auto">Apple Watch makes all the ways you’re used to communicating more convenient. And because it sits right on your wrist, it can add a physical dimension to alerts and notifications. For example, you’ll feel a gentle tap with each incoming message. Apple Watch also lets you connect with your favorite people in fun, spontaneous ways — like sending a tap, a sketch, or even your heartbeat.</p>
                                 </div>
                                 <figure>
                                 <img src="' . $files['watch.communication_hero_large_2x.jpg']->file_path . '" />
                                 </figure>
                                </div>'], ['widget' => 'Offical.PureHTML', 'style' => ['background' => 'white', 'padding' => '0px'], 'data' => '<div style="overflow:hidden;">
                                 <div class="container text-center">
                                     <h1>A smarter way to look at fitness.</h1>
                                     <p class="lead" style="width:60%;margin:auto">Apple Watch gives you a complete picture of your all-day activity. The three rings of the Activity app show your daily progress and help motivate you to sit less, move more, and get some exercise. It’s also an advanced sports watch, giving you real-time stats for a variety of the most popular workouts. Over time, Apple Watch learns your activity and fitness levels. It uses that information to improve the accuracy of your measurements and suggest personalized all-day activity goals. It even provides custom reminders to encourage you to achieve them.</p>
                                 </div>
                                 <figure style="position:relative; margin-top:30px; margin-bottom:-400px; width:1035px; height:931px; margin-left:auto; margin-right:auto; background-image:url(' . $files['watch.health_hero_large_2x.jpg']->file_path . '); background-size:1035px 931px;">
                                 </figure>
                                </div>']]]]);
     $this->command->info('Demo data seeded!');
 }
Example #27
0
 public static function uploadImageWineScan($wine_unique_id)
 {
     $error_code = ApiResponse::OK;
     $user_id = Session::get('user_id');
     $wine = Wine::where('wine_unique_id', $wine_unique_id)->first();
     if ($wine) {
         if (Input::hasFile('file')) {
             $file = Input::file('file');
             $destinationPath = public_path() . '/images/' . $user_id . '/wine/' . $wine->wine_unique_id;
             $filename = date('YmdHis') . '_' . $file->getClientOriginalName();
             $extension = $file->getClientOriginalExtension();
             if (!File::isDirectory($destinationPath)) {
                 File::makeDirectory($destinationPath, $mode = 0777, true, true);
             } else {
                 File::cleanDirectory($destinationPath);
             }
             $upload_success = $file->move($destinationPath, $filename);
             $data = URL::asset('images/' . $user_id . '/wine/' . $wine_unique_id . '/' . $filename);
         } else {
             $error_code = ApiResponse::MISSING_PARAMS;
             $data = null;
         }
     } else {
         $error_code = ApiResponse::UNAVAILABLE_WINE;
         $data = ApiResponse::getErrorContent(ApiResponse::UNAVAILABLE_WINE);
     }
     return array("code" => $error_code, "data" => $data);
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     File::cleanDirectory('uploads/media');
     Schema::drop('media_entries');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(AccountancyRequest $request, $id)
 {
     //
     $acc = Accountancy::find($id);
     \File::cleanDirectory(storage_path('app/accountancy/' . $acc->id));
     \File::deleteDirectory(storage_path('app/accountancy/' . $acc->id));
     $acc->delete();
     return \Redirect::back()->with('message', 'Başarıyla Silindi!');
 }
 public function run()
 {
     DB::table('products_sfs')->truncate();
     File::cleanDirectory(public_path('assets/img/products/sfs'));
     factory(App\ProductSfs::class, 10)->create();
 }