P
P
PythonBeginner202019-12-05 20:39:34
Laravel
PythonBeginner20, 2019-12-05 20:39:34

How to change the path in Laravel routers if the query parameters are not found?

Route::get('/storage/previews/{photo}.{width}.{ts}.jpg.crop.{from}.jpg', '[email protected]')
          ->where('photo', '[0-9]+')
->where('from', '[0-9]+')
 ->where('width', '[0-9]+')
 ->where('ts', '[0-9]+')
 ->name('photo-preview-crop');

The bottom line is that if the file is not found by where -> replace the file with a standard image. How can this be implemented?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin B., 2019-12-05
@PythonBeginner20

Collect the path in the controller, check for the existence of the file and return the one you think is necessary

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question