PHP code example of dyfun / tags
1. Go to this page and download the library: Download dyfun/tags 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/ */
dyfun / tags example snippets
'providers' => [
...
Dyfun\Tags\TagsServiceProvider::class,
...
];
use Illuminate\Database\Eloquent\Model;
use Dyfun\Tags\HasTags;
class File extends Model
{
use HasTags;
...
}
$file = File::find(1);
$file->attachTag("apple");
$file->attachTags(["apple", "orange", "watermelon"]);
$file->detachTag("apple");
$file->detachTags(["apple", "orange"]);
bash
php artisan migrate