-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create static file collections #110
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Reduce complexity, it can easily be handled in the view
Codecov Report
@@ Coverage Diff @@
## master #110 +/- ##
============================================
+ Coverage 98.91% 98.92% +0.01%
- Complexity 741 752 +11
============================================
Files 95 98 +3
Lines 1930 1958 +28
============================================
+ Hits 1909 1937 +28
Misses 21 21
Continue to review full report at Codecov.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
About
Not sure if this is the best name for it, but this update adds a DataCollection module (which may me merged into the core as it became much simpler than I expected), which reads flatfile content and parses them into usable Laravel collections.
Currently only a Markdown collection type is added. This is easel accessible with the MarkdownCollection facade that is made available to Blade views through the DataCollectionServiceProvider.
Supply the name for a subdirectory of the new
_data
directory to the facade to get a collection with the parsed files.Example usage
For example, imagine we have a directory called
_data/testimonials
where we collect testimonials in the form of Markdown files, with front matter to specify the author and link.We can then use the MarkdownCollection facade
To get the testimonials in a Blade view
And if we take a look at the data dump, you'll see that the Markdown files are rendered into the MarkdownDocument object model, same as all Markdown based pages in Hyde.
