What's the right way to save HTML in Laravel using eloquent particularily? - laravel

Do I need to use HTML::entities(Input::get('description')); in laravel to save the htmlText gotten off CKEditor. or has anyone tried it out... thanks.
The idea is to preserve the formatting and retain the text to display on another page, alternatively is there any package in packagist that one can download to strip and work on html inputs...
Please Note :: i am currently using laravel 4.2, so if there are changes in higher versions how can i implement it here..

Add Controller File:
echo e(Input::get('description'));

Related

Laravel blade #includeWhen(request()->is('/contact'),'partials.jumbotron') not working

I want to use jumbotron section only my contact file. That's why i write this directive and code working and no error.
#includeWhen(request()->is('/contact'),'jumbotron')
Is above code format is right? if not
help me experts.
please remove / in request()->is('/contact')

How can i add First and Last page link in my laravel pagination

Right now i am using laravel 5.8 and i am using default pagination with the use of paginate() method for pagination.But i want First and Last page with this. So please help me if any buddy have demo code then please share in Answer section please.
To do this you first need to export the views.
Then you can modify them to add a link to $results->lastPage().

Laravel & Blade templating

I am new to laravel & blade templating also MVC.. I just want to know how to use ids on template file to fetch db values.. can anyone tell me? I can able to save values to db.. but how to get back on same template?
If you're a visual learner, I recommend Laracasts. They've got lots of free content to get you up and running with laravel in no time. They have paid content too. I recommend you visit this link to get the basics of laravel
First read the full docs from the Laravel. After read this
link . The crud is the best for this.:))

Customizing the paginator view in Laravel 5.2

I've been reading the docs and set up a basic app.
Every issue I've had before I've been able to solve by looking in the docs and occasionally using Google, however I can't figure this one out.
I'm using Laravel version 5.2.43 and the Paginator works fine.
I use it in my view like this,
$data->links()
But now I would like to customize the look of the paginator.
So I tried running this command
php artisan vendor:publish --tag=laravel-pagination
In the hopes of simply being able to customize that view instead of creating a new one all over but that command didn't work, it just said
Nothing to publish for tag [laravel-pagination]
So, instead I did this.
{{ $data->links('folder.viewName') }}
But this command gives me this error,
Argument 1 passed to Illuminate\Pagination\LengthAwarePaginator::links() must be an instance of Illuminate\Contracts\Pagination\Presenter, string given
So I'm not sure what's going on. The pagination works but I can't set the view myself.
Any thoughts on what's going on here?
Any help would be greatly appreciated.
I believe you can't do this in Laravel 5.2 without "hacking" the framework. Fortunately, Laravel 5.3 is released this week and it features custom pagination views
Custom pagination in Laravel 5.3
So it turns out I've been reading the 5.3 documentation for Laravel all this time. Which explains a lot of things...
So when 5.3 comes out we can do
$paginator->links("myOwnView")
Until then, I've done it the manual way of using the instances inside the paginator object.

Disable MooTools in VirtueMart

I'm creating a custom module for displaying VirtueMart categories, but need to disable VirtueMart from loading MooTools because it uses an older version of MooTools than what I need. I've searched everywhere, but I can't seem to find the file or function that will allow me to disable it. Any help would be greatly appreciated.
At least in virtuemart 1.5 go to
components/com_virtuemart/themes/YOURTHEME/theme.php
find line about 37, there is a function:
function vmTheme() {
parent::vmTemplate();
vmCommonHTML::loadMooTools();
}
Just comment
vmCommonHTML::loadMooTools();
The only reference to it in the entire project is in mod_virtuemart_currencies.xml. I'm not 100% familiar with Joomla, but this looks like an installer file for a particular currency module.
I'd suggest removing that module, or updating the reference to the MooTools library it's using inside that XML file (line 30 in the currently available version, inside modules/mod_virtuemart_currencies_1.14.j15/mod_virtuemart_currencies.xml).
I was able to resolve my issue. My custom module was using JHTML::script() to load my JavaScript files. That particular function has a third parameter that defaults to true that will automatically load MooTools. You can see the documentation here: http://docs.joomla.org/Adding_JavaScript
If that doesn't do it, put this in your template and it will remove any of the default scripts that Joomla tries to use. Obviously this might remove things necessary for Virtuemart to work right, but it might solve your problem too.
<?php
$user =& JFactory::getUser();
if ($user->get('guest') == 1) {
$headers = $this->getHeadData();
$headers['scripts'] = array();
$this->setHeadData($headers);
}
?>
I created a custom component for front and back ends, and I couldn't (for the life of me) disable mootools. I tried unsetting headers array and all that, and it didn't work!
It worked fine for regular pages where the component was a regular article, but not when it's my custom component.
I was using the JHTML::script() function in my template, and after reading one of the comments here, I tried adding a second parameter (FALSE) to the function and it worked!
Thank you!!!
Any ideas why unsetting mootools from the $document variable's _scripts array doesn't work with custom components?

Resources