PHP code example of ibrahimtelman / voyager-excel-export

1. Go to this page and download the library: Download ibrahimtelman/voyager-excel-export 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/ */

    

ibrahimtelman / voyager-excel-export example snippets


use ExcelExport;


public function setExportable()
{
  //list column of table which you want to export
  //type 1 ["key1", "key2"]
  //type 2 ["key1" => "New Name", "key2" => "New Name"]
  //or with closure ["key1" => [ "name" => "New Name", "value" => function($value, $model){ return $value } ]]
  //you all free to combine three options

  //example
  return array(
    "id", "fullname" => [
          "name" => "Name",
          "value" => function ($value, $model) {
              return strtoupper($value);
          }
      ], "email" => "Email", "phone" => "Phone"
  );
}
bash
php artisan hook:install voyager-excel-export
bash
php artisan hook:enable voyager-excel-export