Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how can we export larage data from table in laravel 8

 $columns = [
            'S. NO',
            'IFSC CODE',
            'BANK NAME',
            'BRANCH NAME',
            'BRANCH ADDRESS',
            'BRANCH PINCODE',
            'BRANCH AREA 1',
            'BRANCH AREA 2',
            'BRANCH STATE',
            'CREATED AT',
            'UPDATED AT',
        ];

// create csv
        return response()->streamDownload(function () use ($columns) {
            $file = fopen('php://output', 'w+');
            fputxlsx($file, $columns);

            $data = IfscMaster::select(
                'id',
                'ifs_code',
                'bank_name',
                'branch_name',
                'branch_address',
                'branch_pincode',
                'branch_area1',
                'branch_area2',
                'branch_state',
                'created_at',
                'updated_at',
            )
                ->orderBy('id', 'desc');

            $data = $data->cursor()
                ->each(function ($data) use ($file) {
                    $data = $data->toArray();
                    fputcsv($file, $data);
                });

            fclose($file);
        }, 'AllUsersCSV' . date('d-m-Y') . '.xlsx');
        die;
Comment

PREVIOUS NEXT
Code Example
Php :: ascii vrednosti php 
Php :: wp clean db terms 
Php :: get product by author id 
Php :: ussd php 
Php :: Save custom input field value into cart item 
Php :: count rows mysql limit php 
Php :: php cgi file not fount linux 
Php :: big database file into database php 
Php :: how to change laravel logo image 
Php :: PHP strncasecmp — Binary safe case-insensitive string comparison of the first n characters 
Php :: Laravel Query: orderBy not working with groupBy (with a joined table) 
Php :: automatically make created_by and updated_by using observer laravel 
Php :: Remove values from select list based on condition 
Php :: namespace autoload php 
Php :: php make text id attribute safe 
Php :: eloquent complex queries 
Php :: Add ACF to single.php 
Php :: pluck only category name and id from model in laravel 
Php :: spatie sluggable not working 
Php :: Laravel To determine if an item is not present in the session 
Php :: PHP how to skip file upload if file already exist 
Php :: change php platform of composer 
Php :: Drupal 9 select node data with query conditions using entity type manager 
Php :: create product model in laravel 
Php :: slow laravel testing 
Php :: show only fatal errors php 
Php :: laravel make request 
Php :: Comment supprimer le fil d’Ariane WooCommerce dans WordPress 
Php :: error import php 
Php :: phpunit exception message contains string 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =