- Replace sidebar layout with top header design - Add product image thumbnail, badges (Active/Featured), and action buttons - Implement real-time badge toggling with inline JavaScript - Add one-active-product-per-brand validation with force-activate option - Standardize checkbox styling with DaisyUI components - Update terminology from "Default" to "Primary" for images - Add new models: ProductLine, ProductPackaging, Unit - Add product line management and image sorting - Add styling rules to CLAUDE.md for consistency 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
71 lines
2.0 KiB
PHP
71 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Seller;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Business;
|
|
use App\Models\ProductLine;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ProductLineController extends Controller
|
|
{
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*/
|
|
public function store(Request $request, Business $business)
|
|
{
|
|
$request->validate([
|
|
'name' => 'required|string|max:255|unique:product_lines,name,NULL,id,business_id,' . $business->id,
|
|
]);
|
|
|
|
ProductLine::create([
|
|
'business_id' => $business->id,
|
|
'name' => $request->name,
|
|
]);
|
|
|
|
return redirect()
|
|
->route('seller.business.products.index1', $business->slug)
|
|
->with('success', 'Product line created successfully.');
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*/
|
|
public function update(Request $request, Business $business, ProductLine $productLine)
|
|
{
|
|
// Ensure business isolation
|
|
if ($productLine->business_id !== $business->id) {
|
|
abort(404);
|
|
}
|
|
|
|
$request->validate([
|
|
'name' => 'required|string|max:255|unique:product_lines,name,' . $productLine->id . ',id,business_id,' . $business->id,
|
|
]);
|
|
|
|
$productLine->update([
|
|
'name' => $request->name,
|
|
]);
|
|
|
|
return redirect()
|
|
->route('seller.business.products.index1', $business->slug)
|
|
->with('success', 'Product line updated successfully.');
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*/
|
|
public function destroy(Business $business, ProductLine $productLine)
|
|
{
|
|
// Ensure business isolation
|
|
if ($productLine->business_id !== $business->id) {
|
|
abort(404);
|
|
}
|
|
|
|
$productLine->delete();
|
|
|
|
return redirect()
|
|
->route('seller.business.products.index1', $business->slug)
|
|
->with('success', 'Product line deleted successfully.');
|
|
}
|
|
}
|