/** * Store a newly created resource in storage. * * @return Response */ public function store(Palette $palette) { $input = Input::all(); $validation = Validator::make($input, Color::$rules); if ($validation->passes()) { $this->color->create($input); return Redirect::route($this->route . '.index', $palette->id); } return Redirect::back()->withInput()->withErrors($validation)->with('message', 'There were validation errors.'); }
public function __construct() { $this->color = Color::create('000000'); $this->type = GoogleChartLabelStyleNumberType::create(); $this->size = 10; $this->dataPoint = -1; }
/** * @dataProvider twoAxisDataProvider **/ public function testTwoAxis($firstAxisData, $secondtAxisData, $result) { foreach ($result as $chartClass => $expectedString) { $views = GoogleChartDataSet::create()->setData($firstAxisData); $clicks = GoogleChartDataSet::create()->setData($secondtAxisData); $chart = new $chartClass(); if ($chart->getData()->isNormalized()) { if ($views->getMax() >= 10) { $base = pow(10, floor(log10($views->getMax()))); } else { $base = 0.1; } $views->setBase($base); if ($clicks->getMax() >= 10) { $base = pow(10, floor(log10($clicks->getMax()))); } else { $base = 0.1; } $clicks->setBase($base); } $viewAxis = GoogleChartAxis::create(new GoogleChartAxisType(GoogleChartAxisType::Y))->setRange($views->getMinMax()); $clickAxis = GoogleChartAxis::create(new GoogleChartAxisType(GoogleChartAxisType::R))->setRange($clicks->getMinMax()); if ($chart->getData()->isNormalized()) { $viewAxis->setInterval($views->getBase()); $clickAxis->setInterval($clicks->getBase()); } $chart->setSize(GoogleChartSize::create()->setWidth(300)->setHeight(300))->addAxis($viewAxis)->addLine(GoogleChartLine::create()->setTitle('Показы')->setColor(Color::create('336699'))->setValue($views))->addAxis($clickAxis)->addLine(GoogleChartLine::create()->setTitle('Клики')->setColor(Color::create('339911'))->setValue($clicks)); $this->assertEquals($expectedString, $chart->toString()); } }
} else { $id = $_REQUEST["id"]; $_REQUEST['mode'] = 'e'; } // if form was submitted: if ($_POST['commit'] == "Cancel") { header("Location:color_list.php?cat=" . $_REQUEST['cat']); exit; } if ($_POST['commit'] == "Save Color") { if ($id == 0) { // insert $obj = new Color(); $obj->CategoryId = $_REQUEST["cat"]; $obj->OverviewText = $_REQUEST["overview_text"]; $obj->create(); // redirect to listing list header("Location:color_list.php&cat=" . $_REQUEST['cat']); exit; } else { // update $obj = new Color($_REQUEST["id"]); $obj->OverviewText = $_REQUEST["overview_text"]; $obj->update(); // redirect to listing list header("Location:color_list.php&cat=" . $_REQUEST['cat']); exit; } } else { if ($_REQUEST['mode'] == 'e') { //listing