| 24 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
namespace App\Http\Controllers;
|
|
|
4 |
|
|
|
5 |
use App\Models\PriceAgency;
|
|
|
6 |
use Illuminate\Http\Request;
|
|
|
7 |
|
|
|
8 |
class PriceAgencyController extends Controller
|
|
|
9 |
{
|
|
|
10 |
//
|
|
|
11 |
|
|
|
12 |
public function show( string $filename )
|
|
|
13 |
{
|
|
|
14 |
$priceAgency = PriceAgency::where( "csv_url", "https://www." . env( "shop" ) . "/preisagentur/" . $filename )->firstOrFail();
|
|
|
15 |
$priceAgency->last_access_at = date( "Y-m-d H:i:s" );
|
|
|
16 |
$priceAgency->last_access_by = $_SERVER["REMOTE_ADDR"];
|
|
|
17 |
header( 'Content-Type: text/plain' );
|
|
|
18 |
header( 'Content-Length: ' . @filesize( "preisagentur/$filename" ) );
|
|
|
19 |
header( 'Content-Disposition: attachment; filename=' . $filename );
|
|
|
20 |
header( 'Expires: 0' );
|
|
|
21 |
readfile( storage_path( "/" ) . $filename );
|
|
|
22 |
$priceAgency->save();
|
|
|
23 |
}
|
|
|
24 |
}
|