mardi 27 novembre 2018

Save excel file into laravel's storage/app/public directory using Store Procedure in mysql

I am trying to store the result into excel sheet and save that file into my laravel storage/app/public folder.

My query is working fine. I got the rows and I am able to save the data into /var/lib/mysql-file/filename.

Now, I am wondering how can I save it to laravel storage folder directly. Passing the file path to var/www/project/storeage/app/public got a permission issue.

Here is my Code:

CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_provisioning_report`(
IN 
categoryId TINYINT(1),
plantId INTEGER(10),
fromDate TIMESTAMP,
toDate TIMESTAMP
)
BEGIN
SELECT 
    column names
INTO 
    OUTFILE '/var/lib/mysql-file/reports.csv'  
    FIELDS TERMINATED BY '\t' 
    LINES TERMINATED BY '\n' 
FROM tables
END



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire