PHPackages                             starfolksoftware/factchecks - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. starfolksoftware/factchecks

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

starfolksoftware/factchecks
===========================

Add factchecking to your Laravel application

v1.2.0(6y ago)135MITPHPPHP ^7.2.5

Since May 7Pushed 6y ago1 watchersCompare

[ Source](https://github.com/starfolksoftware/factchecks)[ Packagist](https://packagist.org/packages/starfolksoftware/factchecks)[ Docs](https://github.com/starfolksoftware/factchecks)[ RSS](/packages/starfolksoftware-factchecks/feed)WikiDiscussions develop Synced 6d ago

READMEChangelog (2)Dependencies (3)Versions (4)Used By (0)

Add factchecks to your Laravel application
==========================================

[](#add-factchecks-to-your-laravel-application)

[![Latest Version on Packagist](https://camo.githubusercontent.com/59baddcd590ab0971531aa0a18fcbe5de26ee5df67132d2993bb91ea170e0a22/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73746172666f6c6b736f6674776172652f66616374636865636b732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/starfolksoftware/factchecks)[![Build Status](https://camo.githubusercontent.com/23fde55af7561f5b89987710fe1e57951da653068464b7b47b875c0a4d48fc86/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f73746172666f6c6b736f6674776172652f66616374636865636b732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/starfolksoftware/factchecks)[![Total Downloads](https://camo.githubusercontent.com/431d1ff9f81a75f4058f559f43bf957730893bd51e05df99149c043bf5c19199/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73746172666f6c6b736f6674776172652f66616374636865636b732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/starfolksoftware/factchecks)

Add the ability to associate factchecks to your Laravel Eloquent models.

```
$post = Post::find(1);

/**
 * Attach a factcheck to this model.
 *
 * @param string $claim
 * @param string $conclusion
 * @return \Illuminate\Database\Eloquent\Model
 */
$post->factcheck('Messi is the great', 'You cant be wrong with that');

/**
 * Attach a factcheck to this model as a specific user.
 *
 * @param Model|null $user
 * @param string $claim
 * @param string $conclusion
 * @return \Illuminate\Database\Eloquent\Model
 */
$post->factcheckAsUser($user, 'Messi is the great', 'You cant be wrong with that');
```

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require starfolksoftware/factchecks
```

The package will automatically register itself.

You can publish the migration with:

```
php artisan vendor:publish --provider="StarfolkSoftware\Factchecks\FactchecksServiceProvider" --tag="migrations"
```

After the migration has been published you can create the media-table by running the migrations:

```
php artisan migrate
```

You can publish the config-file with:

```
php artisan vendor:publish --provider="StarfolkSoftware\Factchecks\FactchecksServiceProvider" --tag="config"
```

Usage
-----

[](#usage)

### Registering Models

[](#registering-models)

To let your models be able to receive factchecks, add the `HasFactchecks` trait to the model classes.

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use StarfolkSoftware\Factchecks\Traits\HasFactchecks;

class Post extends Model
{
    use HasFactchecks;
    ...
}
```

### Creating Factchecks

[](#creating-factchecks)

To create a comment on your commentable models, you can use the `comment` method. It receives the string of the comment that you want to store.

```
$post = Post::find(1);

$factcheck = $post->factcheck(array([
  'claim' => 'Messi is the greatest of all time',
  'conclusion' => 'You cant be wrong with that'
]));
```

The factcheck method returns the newly created factcheck class.

Sometimes you also might want to create factchecks on behalf of other users. You can do this using the `factcheckAsUser` method and pass in your user model that should get associated with this factcheck:

```
$post = Post::find(1);

$factcheck = $post->factcheckAsUser($yourUser, array([
  'claim' => 'Messi is the greatest of all time',
  'conclusion' => 'You cant be wrong with that'
]));
```

### Auto Approve Factchecks

[](#auto-approve-factchecks)

If you want to automatically approve a factcheck for a specific user (and optionally model) you can let your User model implement the following interface and method:

```
namespace App\Models;

use StarfolkSoftware\Factchecks\Contracts\Factchecker;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements Factchecker
{
  /**
   * Check if a comment for a specific model needs to be approved.
   * @param mixed $model
   * @return bool
   */
  public function needsFactcheckApproval($model): bool
  {
    return false;
  }
}
```

The `needsFactcheckApproval` method received the model instance that you want to add a factcheck to and you can either return `true` to mark the factcheck as **not** approved, or return `false` to mark the factcheck as **approved**.

### Auto Approve Factchecks

[](#auto-approve-factchecks-1)

If you want to automatically approve a factcheck for a specific user (and optionally model) you can let your User model implement the following interface and method:

```
namespace App\Models;

use StarfolkSoftware\Factchecks\Contracts\Factchecker;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements Factchecker
{
  /**
   * Check if a comment for a specific model needs to be approved.
   * @param mixed $model
   * @return bool
   */
  public function needsFactcheckApproval($model): bool
  {
    return false;
  }
}
```

The `needsFactcheckApproval` method received the model instance that you want to add a factcheck to and you can either return `true` to mark the factcheck as **not** approved, or return `false` to mark the factcheck as **approved**.

### Submitting Factchecks

[](#submitting-factchecks)

By default, all factchecks that you create are saved as draft and not approved - this is just a datetime column called `submitted_at` that you can use in your views/controllers to filter out factchecks that you might not yet want to display.

To submit a single comment, you may use the `submit` method on the Factcheck model like this:

```
$post = Post::find(1);
$factcheck = $post->factchecks->first();

$factcheck->submit()
```

### Approving Factchecks

[](#approving-factchecks)

After submitting a factcheck, the next stage on the journey to publishing is approval - this is just a datetime column called `approved_at` that you can use in your views/controllers to filter out factchecks that you might not yet want to display.

To approve a single factcheck, you may use the `approve` method on the Factcheck model like this:

```
$post = Post::find(1);
$factcheck = $post->factchecks->first();

$factcheck->approve();
```

### Publishing Factchecks

[](#publishing-factchecks)

After approving a factcheck, the final stage is approval - this is just a datetime column called `published_at` that you can use in your views/controllers to filter out factchecks that you might not yet want to display.

To approve a single factcheck, you may use the `publish` method on the Factcheck model like this:

```
$post = Post::find(1);
$factcheck = $post->factchecks->first();

$factcheck->publish();
```

### Retrieving Factchecks

[](#retrieving-factchecks)

The models that use the `HasFactchecks` trait have access to it's factchecks using the `factchecks` relation:

```
$post = Post::find(1);

// Retrieve all factchecks
$factchecks = $post->factchecks;

// Retrieve only drafted factchecks
$drafts = $post->factchecks()->draft()->get();

// Retrieve only approved factchecks
$approved = $post->factchecks()->approved()->get();

// Retrieve only published factchecks
$published = $post->factchecks()->published()->get();
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Faruk Nasir](https://github.com/frknasir)
- [Marcel Pociot](https://github.com/mpociot)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2201d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f609ab7be5e5a0089c8a3a52861fc379fd2038adb1190e0524c5f46a900fcf0?d=identicon)[starfolksoftware](/maintainers/starfolksoftware)

---

Top Contributors

[![frknasir](https://avatars.githubusercontent.com/u/4984175?v=4)](https://github.com/frknasir "frknasir (10 commits)")

---

Tags

fact-checkingfactcheckingfake-newslaravel-packagestarfolksoftwarestarfolkfactchecks

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/starfolksoftware-factchecks/health.svg)

```
[![Health](https://phpackages.com/badges/starfolksoftware-factchecks/health.svg)](https://phpackages.com/packages/starfolksoftware-factchecks)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)[mrmarchone/laravel-auto-crud

Laravel Auto CRUD helps you streamline development and save time.

28711.8k2](/packages/mrmarchone-laravel-auto-crud)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
