PHP code example of palauaandsons / nova-tags-field
1. Go to this page and download the library: Download palauaandsons/nova-tags-field 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/ */
palauaandsons / nova-tags-field example snippets
use Cartalyst\Tags\TaggableTrait;
use Cartalyst\Tags\TaggableInterface;
use Illuminate\Database\Eloquent\Model;
class BlogPost extends Model implements TaggableInterface
{
use TaggableTrait;
...
}
namespace App\Nova;
use PalauaAndSons\TagsField\Tags;
class BlogPost extends Resource
{
// ...
public function fields(Request $request)
{
return [
// ...
Tags::make('Tags'),
// ...
];
}
}
// in your Nova resource
public function fields(Request $request)
{
return [
// ...
Tags::make('Tags')->single(),
// ...
];
}
namespace App\Nova;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\Text;
use Cartalyst\Tags\IlluminateTag as TagModel;
class Tag extends Resource
{
public static $model = TagModel::class;
public static $title = 'name';
public static $search = [
'name',
];
public function fields(Request $request)
{
return [
Text::make('Namespace')->sortable()->hideWhenUpdating(),
Text::make('Name')->sortable(),
Text::make('Slug')->sortable(),
];
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.