Skip to main content

Ok, after we've covered so much, this will be a very easy and quick one.

We need to have a list of the parking zones/areas, to show them in the application and to allow the user to choose where to start parking.

This will be only one public API endpoint: GET /api/v1/zones

So, let's generate a Controller:

php artisan make:controller Api/V1/ZoneController

Also, we generate the API Resource:

php artisan make:resource ZoneResource

We return only two relevant fields in that API Resource...

The Full Lesson is Only for Premium Members

Want to access all of our courses? (30 h 09 min)

You also get:

55 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

FZ
fatima zohra ezzaidani ✓ Link copied!

why we use this in api.php : Route::get('zones', [ZoneController::class, 'index']); instade of : Route::apiRessource like we did beffor in vehicles?

PK
Povilas Korop ✓ Link copied!

Because here we have only one route and not all the resource with store/edit/destroy etc.

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.