Revision 266 | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed
<?phpnamespace App\Http\Controllers\online_shop;use App\Http\Controllers\Controller;use App\Http\Requests\StoreShippingRequest;use App\Http\Requests\UpdateShippingRequest;use App\Models\Shipping;use App\Models\ShippingGroup;use Illuminate\Contracts\Foundation\Application;use Illuminate\Contracts\View\Factory;use Illuminate\Contracts\View\View;class ShippingController extends Controller{public function __construct(){$inselversand = array("keine Berücksichtigung","kein Inselversand","nur Inselversand",);\View::share( "inselversand", $inselversand );$shippingGroups = ShippingGroup::all();$versandgruppen = array();foreach ( $shippingGroups as $shippingGroup ){$versandgruppen[$shippingGroup->id] = $shippingGroup->name;}\View::share( "versandgruppen", $versandgruppen );}public function index(): Factory|View|Application{$shipping = Shipping::with( "shipping_group" )->whereRaw("supplier_id IS NULL")->orderBy( "rank" )->get();return View( "online_shop.shippingList", [ "shipping" => $shipping ] );}/*** Show the form for creating a new resource.** @return Application|Factory|View*/public function create(): View|Factory|Application{//return view( "online_shop.shipping" );}/*** Store a newly created resource in storage.** @param StoreShippingRequest $request* @return string*/public function store( StoreShippingRequest $request ): string{//$data = $request->validated();Shipping::create( $data );return "{}";}public function show( Shipping $shipping ): void{echo $shipping->name;}/*** Show the form for editing the specified resource.** @param Shipping $shipping* @return Application|Factory|View*/public function edit( Shipping $shipping ): View|Factory|Application{//$shipping->load( 'shipping_group' );return view( "online_shop.shipping", [ "vk" => $shipping, ] );}/*** Update the specified resource in storage.** @param UpdateShippingRequest $request* @param Shipping $shipping* @return string*/public function update( UpdateShippingRequest $request, Shipping $shipping ): string{//$data = $request->validated();$shipping->update( $data );return "{}";}/*** Remove the specified resource from storage.** @param Shipping $shipping* @return string*/public function destroy( Shipping $shipping ): string{//$shipping->delete();return "{}";}}