<?php

namespace App\Http\Controllers;

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

class PrintPreferenceController extends Controller
{
    public function index()
    {
        $preferences = PrintPreference::all();

        // Pass the preferences data to the view
        return view('printPreference.index', compact('preferences'));
    }

    public function create()
    {
        return view('printPreference.create');
    }

    public function store(Request $request)
{
    $request->validate([
        // 'type' => 'required|string|max:255',
        // 'type' => 'required|string|max:255',
    ]);

    // Save data to the database
    PrintPreference::create([
        'type' => $request->type,
        // 'type' => $request->type,
    ]);

    return redirect()->route('printPreference.index')->with('success', 'Print Preference added successfully!');
}

}
