app/Http/Controllers/Laundry/ServicesController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index(Laundry $laundry)
    {
        $services = $laundry->services->map(function($service){
            $service->subName = Str::of($service->name)->replaceMatches('/[^A-Za-z0-9]++/','') ;
            return $service;
        });
         return view('services.index',compact('services','laundry'));
    }
public function index ( Laundry $ laundry ) { $ services = $ laundry -> services -> map ( function ( $ service ) { $ service -> subName = Str :: of ( $ service -> name ) -> replaceMatches ( '/[^A-Za-z0-9]++/' , '' ) ; return $ service ; } ) ; return view ( 'services.index' , compact ( 'services' , 'laundry' ) ) ; }
Display a listing of the resource.
Display a listing of the resource .