what does it mean to find a graph by using a slug attribute?

Figured it out after a few days. Essentially I needed to create a custom resolver.


type Query {
  forumCategoryBySlug(slug: String! @eq): ForumCategory



namespace App\GraphQL\Queries;
use App\Models\ForumCategory;

class ForumCategoryBySlug
     * @param  null  $_
     * @param  array<string, mixed>  $args
    public function __invoke($_, array $args)
        $category = \App\Models\ForumCategory::findBySlug($args["slug"])->first();
        return $category;

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top