Skip to content

Conversation

@ManiruzzamanAkash
Copy link

@ManiruzzamanAkash ManiruzzamanAkash commented Aug 7, 2025

This PR fixes #29

Image

Summary by CodeRabbit

  • Bug Fixes
    • Posts that have been merged are now displayed alongside other posts on the board. Previously, merged posts were excluded from the board view.

@coderabbitai
Copy link

coderabbitai bot commented Aug 7, 2025

Walkthrough

The change removes the use of the notMerged() scope from the query that retrieves posts in the BoardController, now filtering only by board_id without excluding merged posts. All other query logic, including filtering, searching, voting, sorting, and pagination, remains unchanged.

Changes

Cohort / File(s) Change Summary
Remove notMerged Scope from Board Query
app/Http/Controllers/Frontend/BoardController.php
Eliminated the notMerged() scope from the posts query, now filtering only by board_id. No other logic altered.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Assessment against linked issues

Objective Addressed Explanation
Remove usage of notMerged() to fix fatal error in Feature Requests tab (#29)

Poem

A bunny hopped through lines of code,
Where notMerged() once proudly strode.
Now posts appear, both old and new,
No fatal errors to undo!
With queries neat and bugs all gone,
This patch is one to build upon.
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e6f13e9 and ce5d27e.

📒 Files selected for processing (1)
  • app/Http/Controllers/Frontend/BoardController.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/Http/Controllers/Frontend/BoardController.php
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (4)
app/Http/Controllers/Frontend/BoardController.php (4)

1-2: Missing strict types declaration.

The file must start with declare(strict_types=1); as per the coding guidelines for PHP 8.3+.

 <?php
+
+declare(strict_types=1);

18-18: Add explicit return type declaration.

The method should have an explicit return type as per PHP 8.3+ guidelines.

-    public function show(Request $request, Board $board)
+    public function show(Request $request, Board $board): \Illuminate\Http\Response|\Inertia\Response

91-91: Add explicit return type declaration.

The store method should have an explicit return type declaration.

-    public function store(Request $request, Board $board)
+    public function store(Request $request, Board $board): \Illuminate\Http\RedirectResponse

126-126: Add explicit return type declaration.

The private method should have an explicit return type declaration.

-    private function notifyAdmins(Post $post)
+    private function notifyAdmins(Post $post): void
🧹 Nitpick comments (1)
app/Http/Controllers/Frontend/BoardController.php (1)

132-132: Use Model::query() for consistency.

For consistency with coding guidelines, use Model::query() pattern.

-        $admins = User::admin()->get();
+        $admins = User::query()->admin()->get();
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0cd8054 and e6f13e9.

📒 Files selected for processing (1)
  • app/Http/Controllers/Frontend/BoardController.php (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.php

📄 CodeRabbit Inference Engine (.cursor/rules/laravel-conventions.mdc)

**/*.php: PHP 8.3+ required. Use latest language features: typed properties, enums, readonly classes.
Always start files with declare(strict_types=1);.
Follow PSR-12 code style.

**/*.php: Always start files with declare(strict_types=1);.
PHP 8.3+ features must be leveraged (readonly, typed properties, enums, etc.).
Follow PSR-12 strictly.
Avoid magic methods (__get, __set, __call) unless absolutely necessary.
All methods, functions, and properties must be fully typed.
Use void or never return types where appropriate.
Always prefer explicit type declarations over inferred types.
Use dependency injection rather than static access (new Something() inside methods is discouraged).
Use named constructors for complex object creation.
Use docblocks only for revealing array contents (@var list<string>), describing complex structures (generics, traversables), or explaining why something is done.
Use fully qualified class names in docblocks.
Prefer string interpolation with {} braces over concatenation.
Use sprintf when formatting multiple variables.
Always throw typed, domain-specific exceptions.
Avoid generic Exception wherever possible.
Typecast using native casting, not functions (e.g., $id = (int) $id;).
Prefer isset() and array_key_exists() checks for large arrays.
Always use PHP 8.1+ native enum for fixed value sets.
Use PascalCase for enum cases.
Prioritize regex readability and performance.
Use named capture groups and reuse patterns properly in regular expressions.
Always validate and sanitize external input.
Prevent SQL injection by whitelisting columns.
Escape or purify user-supplied HTML before rendering.

Files:

  • app/Http/Controllers/Frontend/BoardController.php
{app,config,routes}/**/*.php

📄 CodeRabbit Inference Engine (.cursor/rules/laravel-conventions.mdc)

Environment variables must only be accessed via config() calls inside application code.

Files:

  • app/Http/Controllers/Frontend/BoardController.php
{app,routes,database}/**/*.php

📄 CodeRabbit Inference Engine (.cursor/rules/laravel-conventions.mdc)

{app,routes,database}/**/*.php: Always use Model::query() instead of direct static methods.
Eager load relations to avoid N+1 queries.
Avoid magic methods like whereName(), prefer explicit where().
Never allow dynamic column names from user input to prevent SQL Injection.
Cache heavy queries using Laravel Cache.
Use dispatch() helper, not static ::dispatch() or Bus Facade.
Use chunking for large datasets (e.g., chunk(100)).
Use eager loading and indexed columns for performance.

Files:

  • app/Http/Controllers/Frontend/BoardController.php
🔇 Additional comments (1)
app/Http/Controllers/Frontend/BoardController.php (1)

28-28: Confirm default behavior after removing undefined notMerged()

Removing the notMerged() call successfully fixes the fatal error. Our search shows there is no scopeNotMerged method or any other usage of notMerged() in the codebase, so merged posts will now be returned by default.

  • No definition or usage of notMerged scope found in the Post model or elsewhere
  • By default, merged posts are now included in the query results

If excluding merged posts remains a requirement, please implement a dedicated scope or filter in a follow-up change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Call to undefined method Illuminate\Database\Eloquent\Builder::notMerged()

1 participant