1. Go to this page and download the library: Download rikless/xporter 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/ */
rikless / xporter example snippets
namespace App\Exports;
use Rikless\Xporter\Exportable;
use Carbon\Carbon;
use Illuminate\Http\Request;
class UsersExporter extends Exportable
{
protected $xportable = ['email', 'uuid'];
protected $rootModel = \App\User::class;
public function convert($item)
{
return [
'email' => $item->email,
'uuid' => $item->name,
];
}
public function query(Request $request)
{
return (new $this->rootModel)->where('created_at', '<=', Carbon::now());
}
}
namespace App\Http\Controllers;
use App\Exports\UsersExporter;
use Illuminate\Http\Request;
class TestController extends Controller
{
public function store(UsersExporter $usersExporter, Request $request)
{
return $usersExporter->build($request);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.