device.php 853 B

123456789101112131415161718192021222324252627
  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::any('/request/addperson', 'Api\DeviceController@addperson');
  14. Route::get('/image/{filename}', function ($filename) {
  15. $path = storage_path('app/public/' . $filename);
  16. $path = $path.'.jpg';
  17. if (!File::exists($path)) {
  18. abort(404);
  19. }
  20. $file = File::get($path);
  21. $type = File::mimeType($path);
  22. return response($file, 200)->header('Content-Type', $type);
  23. });