D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
tattooscyy
/
stage
/
app
/
Libs
/
Filename :
Sum.php
back
Copy
<?php namespace App\Libs; /** * Created by PhpStorm. * User: Александр * Date: 19.05.2015 * Time: 22:08 */ use App\Size; class Sum { public function getPrice($width = null, $height = null) { $sizes = Size::where('catalogs_id', 1)->get(); $ws = (int)((int)$width * (int)$height); //dd($width, $height, $ws); foreach ($sizes as $one) { $wh = explode('-', $one->size); if ($ws >= $wh[0] && $ws < $wh[1]) { $sd = $wh[0] . '-' . $wh[1]; } } if (!isset($sd)) { $sd = '672-700'; } return $sd; } public function getSum($sum = null) { $sizes = Size::where('catalogs_id', 1)->get(); foreach ($sizes as $one) { $wh = explode('-', $one->size); $ws = $sum; if ($ws >= $wh[0] && $ws < $wh[1]) { $sd = $wh[0] . '-' . $wh[1]; } } if (!isset($sd)) { $sd = '672-700'; } return $sd; } }