public function run()
 {
     $colors = ['Galvalume' => ['hex' => 'cad0d2', 'image' => 'galvalume.png'], 'Pure White' => ['hex' => 'eceaee'], 'Polar White' => ['hex' => 'f0f2f3'], 'Ivory' => ['hex' => 'f8e5c6'], 'Light Stone' => ['hex' => 'cccab2'], 'Mocha Tan' => ['hex' => 'b1946f'], 'Patina Green' => ['hex' => '6c7f56'], 'Marine Green' => ['hex' => '5b9994'], 'Forest Green' => ['hex' => '10411e'], 'Hawaiian Blue' => ['hex' => '426d7e'], 'Gallery Blue' => ['hex' => '073e60'], 'Barn Red' => ['hex' => '6e1f19'], 'Patriot Red' => ['hex' => '8c181b'], 'Burgundy' => ['hex' => '512127'], 'Cocoa Brown' => ['hex' => '513d30'], 'Metallic Copper' => ['hex' => 'b15726'], 'Galvanized Silver' => ['hex' => 'afafb1', 'image' => 'galvanized_silver.png'], 'Old Town Gray' => ['hex' => '898b8e'], 'Clay' => ['hex' => '979888'], 'Charcoal Gray' => ['hex' => '565656'], 'Burnished Slate' => ['hex' => '342019'], 'Black' => ['hex' => '030303'], 'Ash Gray' => ['hex' => 'aca1a1'], 'Evergreen' => ['hex' => '394f46']];
     $dirname = dirname(__FILE__);
     foreach ($colors as $colorName => $colorInfo) {
         if (Color::where('name', '=', $colorName)->first()) {
             continue;
         }
         if (empty($colorInfo['hex'])) {
             // Nothing we can do (yet)
             continue;
         }
         // Upload image, if exists
         $colorImage = null;
         if (isset($colorInfo['image'])) {
             copy($dirname . "/default_images/colors/" . $colorInfo['image'], $dirname . "/" . $colorInfo['image']);
             $file = new UploadedFile($dirname . "/" . $colorInfo['image'], $colorInfo['image'], "image/png", filesize($dirname . "/" . $colorInfo['image']), null, true);
             $colorImage = ImageList::upload($file);
         }
         $redHex = substr($colorInfo['hex'], 0, 2);
         $greenHex = substr($colorInfo['hex'], 2, 2);
         $blueHex = substr($colorInfo['hex'], 4, 2);
         $color = Color::firstOrCreate(['name' => $colorName, 'red' => hexdec($redHex), 'green' => hexdec($greenHex), 'blue' => hexdec($blueHex)]);
         $color->save();
         if ($colorImage != null) {
             $color->image()->save($colorImage);
         }
         foreach (Location::all() as $location) {
             foreach (Gauge::all() as $gauge) {
                 $locationColorGauge = new LocationColorGauge();
                 $locationColorGauge->location()->associate($location);
                 $locationColorGauge->color()->associate($color);
                 $locationColorGauge->gauge()->associate($gauge);
                 $locationColorGauge->save();
             }
         }
     }
 }
Exemplo n.º 2
0
 public static function getImage($name)
 {
     $color = Color::where('name', '=', invert_snake_case(str_replace('_', ' _', $name)))->first();
     return $color->image;
 }
 /**
  * Create a new controller instance.
  *
  * @return void
  */
 public function __construct()
 {
     $this->middleware('auth');
     view()->share(array('description' => 'Another Test', 'keywords' => 'More, tests', 'locations' => Location::all()->sortBy('name'), 'models' => ['Analytics', 'Tools', 'Quotes', 'ContactUs', 'EmploymentApps', 'CreditApps', 'ChatLogs', 'User'], 'homepage' => HomePage::where('location_id', '=', Location::current()->id)->first(), 'colors' => Color::all(), 'profiles' => MetalProfile::all(), 'news' => NewsArticle::where('location_id', '=', Location::current()->id)->get(), 'pages' => Page::where('location_id', '=', Location::current()->id)->get()));
 }
<?php

use App\Models\Inventory\Color;
use App\Models\People\Employee;
$wall_color = Color::find($wall_color_id);
$roof_color = Color::find($roof_color_id);
$trim_color = Color::find($trim_color_id);
$sentTo = Employee::find($employee_id)->email;
$employee = Employee::find($employee_id);
$webquoteID = $id;
?>
<style>
	h1 {text-align:center; margin-top:7px; margin-bottom:7px;}
	.fs-title {font-size:20px; margin-top:5px; margin-bottom:7px;}
	h3 { text-align: left; margin-left: 20px; }
	
	.container { text-align: center; }
	.col { width: 86%; display: inline-block; margin: 0 10px; background: #fff; border: 1px solid #000; }
	.reps-only { width: 86%; }
	
	label { display: table-cell; font-weight: bold; padding: 0 10px; width: 180px;text-align: right; }
	p { display: table-cell; margin-top: 0; margin-bottom:3px; margin-left: 10px;}
	
	.vert-margins { padding-top: 15px; padding-bottom: 15px; }
	
	@media screen and (max-width: 670px) {
		.col { width: 95%; margin: 0; padding: 0; }
	}
</style>
<div>
	<h1>{{ $building_type }} Quote</h1>
 public function detach()
 {
     $location = Location::find(Request::input('location'));
     $color = Color::find(Request::input('color'));
     foreach (Gauge::all() as $gauge) {
         $locationColorGauge = LocationColorGauge::where('location_id', '=', $location->id)->where('color_id', '=', $color->id)->where('gauge_id', '=', $gauge->id);
         if ($locationColorGauge->first()) {
             $locationColorGauge->first()->delete();
         }
     }
     return "success";
 }