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? (36 h 00 min)

You also get:

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

Already a member? Login here

fatima zohra ezzaidani avatar
fatima zohra ezzaidani

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

Povilas Korop avatar

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

👍 4

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.