Subject | Hash | Author | Date (UTC) |
---|---|---|---|
Initial Commit | 31265bb888791eb58829bdf07222d319a3387629 | EyadMohammedOsama | 2019-08-08 22:17:19 |
Added router for downloads | 700b80e06b8b1809135fe32c0072beb7542570c6 | EyadMohammedOsama | 2019-08-08 22:17:08 |
Fiddle favoriting event implementation | 5ea13953d8fdd949d122ff3d63bc427d2ac78a43 | EyadMohammedOsama | 2019-08-07 23:21:04 |
Added a trigger to fiddle favoriting | 435bb1aacd90b540e822b68858a665955e7b6f35 | EyadMohammedOsama | 2019-08-07 23:20:20 |
Added Pusher.js | ca81b2a591c04e678e415c3fdf10a41a3a11ac62 | EyadMohammedOsama | 2019-08-07 23:18:08 |
Configured broadcasting | 61ad3285cfc37dfb4265874cf7b3496992846f7e | EyadMohammedOsama | 2019-08-07 23:17:36 |
Installed PHP Pusher | 85bd7fa0401d69eff36ea21fa6bb60f28601ac14 | EyadMohammedOsama | 2019-08-07 23:16:31 |
Initial commit | 4a865759d403eda3854c69005a3cfdbd7d737096 | EyadMohammedOsama | 2019-08-05 21:13:21 |
Added several new routes | 85e08b7120e6ba249f3ecd523234c72f5c19c1cc | EyadMohammedOsama | 2019-08-05 21:12:53 |
Added several new routes | ba3fca128d64c47fa0e9c8c08fd5e0a6635b08ae | EyadMohammedOsama | 2019-08-04 23:15:44 |
Configured sessions table | 749fa85c728ab023aee73bff8f08677063edc70a | EyadMohammedOsama | 2019-08-04 23:15:19 |
Added a file system to store avatars | e260a81485424f72c8a5154a91d5f7c83e180af5 | EyadMohammedOsama | 2019-08-04 23:15:00 |
Added new validation rules | 42c291c0cbc2181e1fd9cf87991fded5550512cf | EyadMohammedOsama | 2019-08-04 23:14:36 |
Added new controllers | c7a9229044be1d910911b89a6a049c0e0b4bd3a9 | EyadMohammedOsama | 2019-08-04 23:14:08 |
Added new helper file | d4d3fd48a15af64a3abaffee411ecf542670be9b | EyadMohammedOsama | 2019-08-04 23:13:20 |
Added new models | 0af667e894277c7a08499ac0bb2a82650485ccb9 | EyadMohammedOsama | 2019-08-04 23:13:03 |
Added new views | e4ba7fc0daf2c8a9200a76e8d122ea52a9e56972 | EyadMohammedOsama | 2019-08-04 23:12:09 |
Added a helper file | 86cd8e39ae94a78b3caa4e5eedea0f465c5716dd | EyadMohammedOsama | 2019-08-04 23:11:00 |
Deleted some files | 9c2486581af5e537a7f9ffa64b2b02e8c9d5f42e | EyadMohammedOsama | 2019-08-02 23:30:55 |
Updated to ignore Thumbs.db files | 3baa87ecef6d298d4a8a2904baf08f7102f23074 | EyadMohammedOsama | 2019-08-01 21:27:32 |
File | Lines added | Lines deleted |
---|---|---|
app/Http/Controllers/DownloadFiddle.php | 30 | 0 |
File app/Http/Controllers/DownloadFiddle.php added (mode: 100644) (index 0000000..a82749b) | |||
1 | <?php | ||
2 | |||
3 | namespace SICSF\Http\Controllers; | ||
4 | |||
5 | use Illuminate\Http\Request; | ||
6 | use SICSF\Fiddles; | ||
7 | |||
8 | class DownloadFiddle extends Controller | ||
9 | { | ||
10 | /** | ||
11 | * Handle the incoming request. | ||
12 | * | ||
13 | * @param \Illuminate\Http\Request $request | ||
14 | * @return \Illuminate\Http\Response | ||
15 | */ | ||
16 | public function __invoke(Request $request, $id) | ||
17 | { | ||
18 | if (!Fiddles::FiddleExists($id)) { | ||
19 | abort(404, "The fiddle you were trying to download doesn't exist."); | ||
20 | } | ||
21 | else { | ||
22 | $Code = Fiddles::GetFiddle($id)->Code; | ||
23 | $Title = Fiddles::GetFiddle($id)->Title; | ||
24 | $FileName = $Title . ".html"; | ||
25 | return response()->streamDownload(function() use($Code) { | ||
26 | echo $Code; | ||
27 | }, $FileName); | ||
28 | } | ||
29 | } | ||
30 | } |