PHP code example of mansoor / filament-unsplash-picker

1. Go to this page and download the library: Download mansoor/filament-unsplash-picker 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/ */

    

mansoor / filament-unsplash-picker example snippets


'unsplash' => [
    'client_id' => env('UNSPLASH_CLIENT_ID'),
],

use Mansoor\UnsplashPicker\Actions\UnsplashPickerAction;

Forms\Components\FileUpload::make('featured_image')
    ->image()
    ->hintAction(
        UnsplashPickerAction::make()
    )

SpatieMediaLibraryFileUpload::make('featured_image')
    ->image()
    ->hintAction(
        UnsplashPickerAction::make()
    )

UnsplashPickerAction::make()
    ->regular()

FileUpload::make('featured_image')
    ->multiple() // This will indicate the plugin to allow the user to pick multiple files
    ->hintAction(
        UnsplashPickerAction::make()
    )

UnsplashPickerAction::make()
    ->perPage(20)

UnsplashPickerAction::make()
    ->useSquareDisplay(false)

UnsplashPickerAction::make()
    ->defaultSearch('Hello world')

UnsplashPickerAction::make()
    ->defaultSearch(fn (Get $get) => $get('title'))

UnsplashPickerAction::make()
    ->afterUpload(function (array $data) {
        dd($data);
    })

SpatieMediaLibraryFileUpload::make('media')
    ->extraAlpineAttributes(function ($component) {
        return [
            'custom-attribute' => 'custom-attribute-value-goes-here',
            ...UnsplashPickerAction::getExtraAlpineAttributes($component),
        ];
    })
js
content: [
    ...
    './vendor/mansoor/filament-unsplash-picker/resources/views/**/*.blade.php',
],
bash
php artisan vendor:publish --tag="filament-unsplash-picker-views"