device.php 909 B

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