device.php 785 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | Web Routes
  5. |--------------------------------------------------------------------------
  6. |
  7. | Here is where you can register web routes for your application. These
  8. | routes are loaded by the RouteServiceProvider within a group which
  9. | contains the "web" middleware group. Now create something great!
  10. |
  11. */
  12. Route::any('/request/heartbeat', 'Api\DeviceController@heartbeat');
  13. Route::get('/image/{filename}', function ($filename) {
  14. $path = storage_path('app/public/' . $filename);
  15. $path = $path.'.jpg';
  16. if (!File::exists($path)) {
  17. abort(404);
  18. }
  19. $file = File::get($path);
  20. $type = File::mimeType($path);
  21. return response($file, 200)->header('Content-Type', $type);
  22. });