php - Export .csv from Mysql table - CSV phpleague & Laravel -


i beginner laravel, , need help. got model name onlineszallas, , want export table .csv file. followed instructions found in api documentation, gives me 404 error page not found.

the route wrote route::get('export', 'pages\outputcontroller@export');

and controller:

<?php  namespace app\http\controllers\pages;    use app\model\onlineszallas; use illuminate\http\request; use app\http\requests; use app\http\controllers\controller; use league\csv\writer; use schema; use splfileobject;  class outputcontroller extends controller {  public function export() {     $people = onlineszallas::all();      /*$csv = \league\csv\writer::createfromfileobject(new \spltempfileobject());*/      $csv = writer::createfrompath(new splfileobject('/public/assets/public/documents/file.csv', 'a+'), 'w');      $csv->insertone(\schema::getcolumnlisting('people'));      foreach ($people $person) {         $csv->insertone($person->toarray());     }      $csv->output('file.csv'); }  } 

if write url browser http://..../export , give me error , nothing happened.

thanks help!


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -