PHP code example of tomodo531 / filterable-filters
1. Go to this page and download the library: Download tomodo531/filterable-filters 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/ */
tomodo531 / filterable-filters example snippets
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Article extends Model
{
use HasFactory;
protected $fillable = [
'title',
'content',
];
public function categories()
{
return $this->belongsToMany(Category::class, 'category_article');
}
public function author()
{
return $this->belongsTo(User::class, 'user_id');
}
}