Specifications are structured data
Trailer attributes and descriptive tags are represented separately from the sales copy, supporting the catalog and detailed product pages.
Make the next trailer easier to find.
DRD Trailers is client work for DRD Truck and Equipment Sales. The website gives commercial inventory a structured home, with product detail pages and a straightforward route to the business.
Equipment buyers need specifics. The site needs to present trailer listings and their supporting details without making the catalog difficult to navigate.
A Laravel catalog organizes inventory and product detail pages, with galleries, specification filters, company information, and contact pages.
Trailer attributes and descriptive tags are represented separately from the sales copy, supporting the catalog and detailed product pages.
The administrative catalog gives the business a place to maintain inventory, photographs and supporting content.
Product slugs provide readable listing URLs. The detail page connects photographs and equipment information to the next contact step.
NestedTerms is used here as an embedded legacy implementation. Product specifications and descriptors flow through BiMorphable, term-scoped correlations and parent-linked tags. These are the application’s existing APIs; the current Composer release has a different interface.
The product reads the specification term and turns each entered hierarchy into a Tag before assigning its correlations. BiMorphable resolves those relationships; the public inventory filters and product details consume them.
NestedTerms package ↗public function getSpecificationsAttribute(){
return $this->getCorrelation('specification');
}
public function setSpecificationsAttribute($specifications){
$specs = [];
foreach(array_filter($specifications) as $specification){
$specs[] = Tag::firstOrCreateFromString($specification);
}
return $this->setCorrelation('specification', $specs);
}
The embedded Tag implementation walks each segment, carries the parent ID forward and returns the most specific tag. That keeps equipment attributes structured beyond their display labels.
NestedTerms package ↗public static function firstOrCreateFromString($string)
{
$strings = array_map(fn($piece)=>trim($piece), explode(">", $string));
$parent_id = null;
$nested_value = "";
foreach($strings as $s){
$nested_value = $nested_value ? $nested_value . " > " . $s : $s;
$tag = Tag::firstOrCreate(['name'=>$s, 'slug'=>Str::slug($nested_value), "value"=>$nested_value, 'parent_id'=>$parent_id]);
$parent_id = $tag->id;
}
return $tag;
}
Completed client website for DRD Truck and Equipment Sales.
Designed, Developed and Hosted by Better Web Design and Development Services, LLC