<?php

namespace App\Http\Controllers\Admin;

use App\Color;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class ColorController extends Controller
{
    public function create($setId){
        return view('admin.colors.add_color',compact('setId'));
    }

    public function store(Request $request){
       foreach($request->name as $key=>$item){
          Color::create([
              'preset_id' => $request->preset_id,
              'name' => $item,
              'value' => $request->value[$key]
          ]);
       }
    }

    public function show($id){
        $colors = Color::where('preset_id',$id)->get();
        return view('admin.colors.color_view',compact('colors'));
    }
}
