Subscribe to PHP Freaks RSS

Freek Van der Herten: Introducing BladeX View Models

syndicated from www.phpdeveloper.org on October 5, 2018

In a new post to his site Freek Van der Herten announces the release of their latest package to help with the integration of the BladeX functionality into your Laravel views - using them with view models.

Earlier today we released BladeX, a package that allows you to use Blade components using a Vue inspired syntax.

[...] In the latest North Meets South podcast Jacob and Michael discussed BladeX and wondered if the package could be married with view models or Laravel's View Composers. Our team discussed this too last Friday but we decided to release the core features of BladeX first. After the release today it became apparent pretty fast that we needed some sort of view model support in our projects too. So we got to work!

He then walks you through how to integrate the two pieces of functionality to render a select element containing a country list. He includes the backend code to make the connection between BladeX and the model as well as the view model and template code. He finishes the post with an example of what the result should look like, containing the three countries from his list.