PHP code example of nova-kit / nova-queued-export-as-csv
1. Go to this page and download the library: Download nova-kit/nova-queued-export-as-csv 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/ */
nova-kit / nova-queued-export-as-csv example snippets
use Laravel\Nova\Actions\ExportAsCsv;
use NovaKit\NovaQueuedExportAsCsv\Actions\QueuedExportAsCsv;
/**
* Get the actions available for the resource.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @return array
*/
public function actions(NovaRequest $request)
{
return [
QueuedExportAsCsv::make(),
];
}
use Laravel\Nova\Actions\Action;
use NovaKit\NovaQueuedExportAsCsv\Actions\QueuedExportAsCsv;
return [
QueuedExportAsCsv::make()->then(function () {
return response()->json(Action::message('Action has been queued!'));
}),
];
namespace App\Listeners;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Facades\Storage;
use Laravel\Nova\Notifications\NovaNotification;
use Laravel\Nova\URL;
use NovaKit\NovaQueuedExportAsCsv\Events\QueuedCsvExported;
class NotifyCsvExported
{
/**
* Handle the event.
*
* @param \NovaKit\NovaQueuedExportAsCsv\Events\QueuedCsvExported $event
* @return void
*/
public function handle(QueuedCsvExported $event)
{
$event->user->notify(
NovaNotification::make()
->message('Your CSV is ready to download.')
->action('Download', URL::remote(Storage::disk($event->storageDisk)->url($event->filename)))
->icon('download')
->type('info')
);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.