PHP code example of bbs-lab / nova-cloudinary-field
1. Go to this page and download the library: Download bbs-lab/nova-cloudinary-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/ */
declare(strict_types=1);
namespace App\Nova;
use BBSLab\CloudinaryField\Cloudinary;
use Laravel\Nova\Fields\Boolean;
use Laravel\Nova\Fields\FormData;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
class BlogPost extends Resource
{
// ...
public function fields(NovaRequest $request): array
{
return [
ID::make()->sortable(),
Text::make('Title')
->sortable()
->rules('red');
} else {
$field->hide();
}
}),
];
}
}
declare(strict_types=1);
namespace App\Providers;
use BBSLab\CloudinaryField\NovaCloudinary;
use Laravel\Nova\NovaApplicationServiceProvider;
class NovaServiceProvider extends NovaApplicationServiceProvider
{
// ...
public function tools(): array
{
return [
NovaCloudinary::make(),
];
}
}