According to Laravel Documentation
In other frameworks, pagination can be very painful. Laravel makes it a breeze. Laravel can quickly generate an intelligent "range" of links based on the current page, and the generated HTML is compatible with the Bootstrap CSS framework.
My question is Foundation also compatible with Laravel's pagination?
There is nothing to stop Laravel pagination working with Foundation but the default HTML generated by Laravel is Bootstrap specific. There is no mention in the docs or API to suggest that it can generate Foundation-specific code.
You have two choices. One is to write your own custom code (covered elsewhere on Stack Overflow, although not specifically for Foundation)
The other option is to pull in a specific package that someone else has written:
Laravel 4
https://github.com/binarix/Laravel-Foundation-Pagination
Laravel 5
https://github.com/etcinit/foundation-pagination
You can easily pass the paginator data to your own view of a paginator. - Meaning you can do the following:
Create a folder named components in your views folder and then create a pagination view; after pass the pagination data to the component created and include it as shown below in any of your views.
Getting a paginated data set:
$yourPaginationData = App\YourModel::orderBy('id', 'desc')->with(['relation'])->paginate(15)
Including the pagination:
#include('components.pagination', ['paginator' => $yourPaginationData])
In the view, one can manipulate the pagination data as needed and create their own design and idea of pagination.
You can also find something open-source for foundation that was custom built to work with laravel here.
Related
I have controller, which worked on Laravel 5.2 and used library yangqi/Htmldom (based on simple HTML DOM parser). Now I need to make the same logic on Laravel 8 and I can't find a library, which is based on simple HTML dom parser and working on Laravel 8 (yangqi/Htmldom - not working with Laravel 8).
I have all the need for logic based on simple HTML dom and I don't want to make it again with another library (for example Goutte).
Maybe someone can help me connect a simple HTML dom parser to Laravel 8?
Problem was fixed to next steps:
We need to change one part of code in package yangqi/Html Dom, instruction here.
We need hyphen need to be escaped in all places like wrote here.
I'm starting a new large-scale application and after hearing a lot about VueJS + Laravel combination i thought of using it. I followed Laracasts' Learn Vue 2: Step By Step series and some tutorials to understand how it works.
But have few questions in mind:
Why do we even need to use Vue with Laravel. I understand that we can create component like <user-profile></user-profile> in Vue, and then use it in Laravel Blade. But it looks like over-complication things? Firstly we pass data from controller to blade, and then further pass it to vue. Why do we need to do that?
Laravel and Vue both have their own routing system. Which one to use?
How to structure an app using Laravel + Vue
PS. I'm making an application that will mostly be used on mobile devices.
moved from comment
Why do we even need to use Vue with Laravel.
Although you probably already knew, Vue is just one of many javascript frontend frameworks (libs?) You can consume the data send from the server any way you want. Vue is just the sister-framework of Laravel. The only thing you can probably say as to why they are mentioned together is that you can "talk" (interface) easily between them using json objects. Javascript is meant to make your page interactive, have behaviour. Use it when you need this.
Laravel and Vue both have their own routing system. Which one to use?
Whatever you want, do you want a "single page" (blade) that is rendered in 3 different pages by Vue, say like some kind of Wizard form. It really depends on where you want to put the load. I think you can think of use-cases where client side page rendering would be better, but most of the time server sided will be a great choice.
Single page applications are more snappy (faster) after initial load, but server side rendered applications are better for SEO in general. There are also ways to let a SPA render on the server to improve SEO however. And this we we can keep the discussion going for some while.
How to structure an app using Laravel + Vue
Laravel has already an example vue file under resources/assets/js/app.js. So it is safe to assume you can put everything there.
I'm going to launch a new project with this two frameworks (I like):
Laravel 5
Vue.js
The Frontend developer prepares the HTML's in atomic design, generated with patternlab.io.
Now I'm looking how I can integrate the patternlab.io project that I don't have to rewrite all the elements in a blade template.
I found some implementations combining Patternlab & Laravel using TwigBridge, Laratash Laravel extensions.
But I've some thoughts:
In the blade templates there is: logic, conditions, loops,.... If I combine patternlab and laravel then I need to put all this in the patternlab project.
Because of using vue.js I need to add also these tags to the patternlab templates
So I think it's not the best choice to integrate the patternlab.io templates in the laravel project.
My idea was:
Frontend DEV uses patternlab to create the templates
Laravel automatically generates & imports the CSS Stylesheet generated in patternlab
The Backend Developers copy the patternlab - molecules manually in the blade templates and add their own logic
If the Frontend DEV make changes on CSS, it's fine - we'll run in no issues; after rerunning the laravel gulp process to update the css files we have the new updates.
If the Frontend DEV makes some changes on a html structure we need to manually adjust them.
Is there a better solution combining Atomic Design, Vuejs and Laravel? How do you deploy atomic design in your CMS?
In the last three Vue/Laravel projects we've created we'v stopped using PHP as a rendering engine all together and used Vue exclusively. Laravel is still a really great framework for writing business logic and apis in a clean testable way – but we've decided to never use blade again.
Typically the issue you run into when trying to create a JS rendered application with a PHP backend is the lack of server side rendering. To solve this problem I've turned to a new project out of the Vue community, Nuxt.js (I have no affiliation with them, just a happy developer). Nuxt lets you write vue components and have them be both server side rendered, and rendered in the browser after the initial page load.
This allows us to completely decouple all of the rendering responsibilities away from Laravel and keep it in a single location, so no need to do blade and Vue – it's all Vue.
The only downside is that you'll need 2 servers Node.js and PHP.
I have a Laravel application which is using Blade as the frontend. I'm feeling the better (more future proof) option would be to switch to Angular, Vue or React, (not entirely sure yet which one I will use but that's not the question of this post)
I've always thought that the backend code should expose an API in order for these JS frontend frameworks to work. I currently don't expose any sort of API.
I basically designed it in the normal way:
define route pointing to controller
create controller function and direct it to a view
create the Blade view
Couple of questions:
Should I redesign my backend to expose such an API?
Can I call Angular/Vue/React code from my controllers, similar to what I'm
doing with Blade?
In case the answer is yes to question 1,
shouldn't I consider changing to Lumen then?
using frontend framework means you would most likely build you backend as an API,
a common scenario is:
a single route the points to a controller which loads the angular/vue app
the angular/vue app would handle views and templates.
once the app is loaded you only need to communicate with the server through the exposed api's
you can't call you js code from laravel controller and you probably won't need to.
as for your question lumen vs laravel, I think it's up to you to decide that. both have pro's con's.
I want to make an MVC 5 app that will allow users to customize views/pages, create new ones. On the custom pages they can set-up widgets and be able to save the views. Also they should be able to setup the default view that will be loaded by default.
Any ideas how can I achieve this? I believe the views should be saved in the database.
EDIT:
I found this template engine RazorEngine. This seams to be what I am looking for. Anybody has any experience using RazorEngine?
I think you should try some CMS like dotnetnuke etc. other wise build your own framework for all the things so that it can save and fetch your details to and from database.