public function run()
 {
     $profiles = ['Residential' => ['coverage' => 36], 'PBR' => ['coverage' => 36], 'Secure-Seam Standing Seam' => ['coverage' => 18], 'Perma-Lok Standing Seam' => ['coverage' => 16], '5-V' => ['coverage' => 24], 'Corrugated' => ['coverage' => 24], 'MECH-SEAM' => ['coverage' => 16]];
     $dirname = dirname(__FILE__);
     foreach ($profiles as $profileName => $profileInfo) {
         if (MetalProfile::where('name', '=', $profileName)->first()) {
             continue;
         }
         /*
         // Upload profile image
         copy( $dirname . "/default_images/colors/" . $colorInfo['image'], $dirname . "/" . $colorInfo['image'] );
         $file = new UploadedFile(
         	$dirname . "/" . $colorInfo['image'],             // path
         	$colorInfo['image'],                              // originalName
         	"image/png",                                      // mimeType
         	filesize( $dirname . "/" . $colorInfo['image'] ), // size
         	null,                                             // error
         	true                                              // test
         );
         $profileImage = ImageList::upload( $file );
         
         // Upload overhead image
         copy( $dirname . "/default_images/colors/" . $colorInfo['image'], $dirname . "/" . $colorInfo['image'] );
         $file = new UploadedFile(
         	$dirname . "/" . $colorInfo['image'],             // path
         	$colorInfo['image'],                              // originalName
         	"image/png",                                      // mimeType
         	filesize( $dirname . "/" . $colorInfo['image'] ), // size
         	null,                                             // error
         	true                                              // test
         );
         $overheadImage = ImageList::upload( $file );
         */
         $profile = MetalProfile::firstOrCreate(['name' => $profileName, 'coverage' => $profileInfo['coverage']]);
         $profile->save();
         foreach (Location::all() as $location) {
             foreach (Gauge::all() as $gauge) {
                 $locationProfileGauge = new LocationProfileGauge();
                 $locationProfileGauge->location()->associate($location);
                 $locationProfileGauge->metalProfile()->associate($profile);
                 $locationProfileGauge->gauge()->associate($gauge);
                 $locationProfileGauge->save();
             }
         }
     }
 }
<?php

$title = "Secure-Seam :: Roofing";
use App\Models\Inventory\MetalProfile;
$gauges = collect();
// There has GOT to be a smarter way to do this...
$locationProfileGauges = $location->profileGauges()->where('metal_profile_id', '=', MetalProfile::where('name', 'Secure-Seam Standing Seam')->first()->id)->get();
foreach ($locationProfileGauges as $locationProfileGauge) {
    $gauges->push($locationProfileGauge->gauge);
}
?>
@extends('page')

@section('content')
<div class="row">
	<div class="six columns">
		<h1>Secure-Seam Roofing Panel</h1>
		<img class="profile-sample" src="/static_img/roofing/secure-seam/sample.jpg">
		<ul>
			<li>Available in all {{ count( $colors ) }} colors</li>
			<li>Also in Acrylic Coated Galvalume</li>
			<li>14", 16" &amp; 18" Net Coverage</li>
			<li>
@foreach( $gauges as $key => $gauge )
	@if( $key == count( $gauges ) - 1 )
				and {{ $gauge->name() }}
	@else
				{{ $gauge->name() }}, 
	@endif
@endforeach
			</li>
<?php

$title = "Residential :: Roofing";
use App\Models\Inventory\MetalProfile;
$gauges = collect();
// There has GOT to be a smarter way to do this...
$locationProfileGauges = $location->profileGauges()->where('metal_profile_id', '=', MetalProfile::where('name', 'Residential')->first()->id)->get();
foreach ($locationProfileGauges as $locationProfileGauge) {
    $gauges->push($locationProfileGauge->gauge);
}
?>
@extends('page')

@section('content')
<div class="row">
	<div class="six columns">
		<h1>Residential Roofing Panel</h1>
		<img class="profile-sample" src="/static_img/roofing/residential/sample.jpg">
		<ul>
			<li>Available in all {{ count( $colors ) }} colors</li>
			<li>Also in Acrylic Coated Galvalume</li>
			<li>36" Net Coverage</li>
			<li>
@foreach( $gauges as $key => $gauge )
	@if( $key == count( $gauges ) - 1 )
				and {{ $gauge->name() }}
	@else
				{{ $gauge->name() }}, 
	@endif
@endforeach
			</li>
Ejemplo n.º 4
0
<?php

$title = "MECH-SEAM :: Roofing";
use App\Models\Inventory\MetalProfile;
$gauges = collect();
// There has GOT to be a smarter way to do this...
$locationProfileGauges = $location->profileGauges()->where('metal_profile_id', '=', MetalProfile::where('name', 'MECH-SEAM')->first()->id)->get();
foreach ($locationProfileGauges as $locationProfileGauge) {
    $gauges->push($locationProfileGauge->gauge);
}
?>
@extends('page')

@section('content')
<div class="row">
	<div class="six columns">
		<h1>MECH-SEAM Roofing Panel</h1>
		<img class="profile-sample" src="/static_img/roofing/mech-seam/sample.jpg">
		<ul>
			<li>Available in all {{ count( $colors ) }} colors</li>
			<li>Also in Acrylic Coated Galvalume</li>
			<li>16" Net Coverage</li>
			<li>
@foreach( $gauges as $key => $gauge )
	@if( $key == count( $gauges ) - 1 )
				and {{ $gauge->name() }}
	@else
				{{ $gauge->name() }}, 
	@endif
@endforeach
			</li>
 public function detach()
 {
     $location = Location::find(Request::input('location'));
     $profile = MetalProfile::find(Request::input('profile'));
     foreach (Gauge::all() as $gauge) {
         $locationProfileGauge = LocationProfileGauge::where('location_id', '=', $location->id)->where('metal_profile_id', '=', $profile->id)->where('gauge_id', '=', $gauge->id);
         if ($locationProfileGauge->first()) {
             $locationProfileGauge->first()->delete();
         }
     }
     return "success";
 }
Ejemplo n.º 6
0
 /**
  * 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

$title = "Corrugated :: Roofing";
use App\Models\Inventory\MetalProfile;
$gauges = collect();
// There has GOT to be a smarter way to do this...
$locationProfileGauges = $location->profileGauges()->where('metal_profile_id', '=', MetalProfile::where('name', 'Corrugated')->first()->id)->get();
foreach ($locationProfileGauges as $locationProfileGauge) {
    $gauges->push($locationProfileGauge->gauge);
}
?>
@extends('page')

@section('content')
<div class="row">
	<div class="six columns">
		<h1>Corrugated Roofing &amp; Siding Panel</h1>
		<img class="profile-sample" src="/static_img/roofing/corrugated/sample.jpg">
		<ul>
			<li>Available in all {{ count( $colors ) }} colors</li>
			<li>Also in Acrylic Coated Galvalume</li>
			<li>24" Net Coverage</li>
			<li>
@foreach( $gauges as $key => $gauge )
	@if( $key == count( $gauges ) - 1 )
				and {{ $gauge->name() }}
	@else
				{{ $gauge->name() }}, 
	@endif
@endforeach
			</li>