1. Go to this page and download the library: Download starfolksoftware/factchecks library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
starfolksoftware / factchecks example snippets
$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');
$post = Post::find(1);
$factcheck = $post->factcheck(array([
'claim' => 'Messi is the greatest of all time',
'conclusion' => 'You cant be wrong with that'
]));
$post = Post::find(1);
$factcheck = $post->factcheckAsUser($yourUser, array([
'claim' => 'Messi is the greatest of all time',
'conclusion' => 'You cant be wrong with that'
]));
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;
}
}
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;
}
}