PHP code example of illizian / nova-suggest-wrapper

1. Go to this page and download the library: Download illizian/nova-suggest-wrapper 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/ */

    

illizian / nova-suggest-wrapper example snippets


/* ... */
use \Illizian\NovaSuggestWrapper\NovaSuggestWrapper;
/* ... */

class Example extends Resource
{
    /* ... */
    public function fields(Request $request)
    {
        return [
            /* ... */
            NovaSuggestWrapper::make(
                [
                    Textarea::make(__('Textarea'), 'textarea')
                ]
            )->suggestions([ "foo", "foobar" ]),
        ];
    }

/* ... */
use \App\Models\User;
use \Illizian\NovaSuggestWrapper\NovaSuggestWrapper;
/* ... */

class Example extends Resource
{
    /* ... */
    public function fields(Request $request)
    {
        $users = User::all()->pluck('username')->toArray();

        return [
            /* ... */
            NovaSuggestWrapper::make(
                [
                    Textarea::make(__('Textarea'), 'textarea')
                ]
            )->trigger('@')->suggestions($users),
        ];
    }