Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace AppHttpControllers;
- use IlluminateHttpRequest;
- use AppExportsMttRegistrationsExport;
- use MaatwebsiteExcelFacadesExcel;
- class ExcelController extends Controller
- {
- public function export($id)
- {
- return Excel::download(new MttRegistrationsExport, 'MttRegistrations.xlsx', compact('id'));
- }
- }
- <?php
- namespace AppExports;
- use AppMttRegistration;
- use MaatwebsiteExcelConcernsFromCollection;
- class MttRegistrationsExport implements FromCollection
- {
- /**
- * @return IlluminateSupportCollection
- */
- public function collection()
- {
- return MttRegistration::where('lifeskill_id',$id)->get()([
- 'first_name', 'email'
- ]);
- }
- }
- Route::get('/mtt/attendance/{id}',[
- 'as' => 'mtt.attendance',
- 'uses' => 'ExcelController@export']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement