Skip to content

Instantly share code, notes, and snippets.

@wiratama
wiratama / laravel-mix-cheatsheet
Last active July 20, 2021 22:19
Laravel mix API cheat sheet
/*** Laravel mix API cheat sheet **/
mix.js(src, output);
mix.react(src, output); /** Identical to mix.js(), but registers React Babel compilation. **/
mix.extract(vendorLibs);
mix.sass(src, output);
mix.standaloneSass('src', output); /** Faster, but isolated from Webpack. **/
mix.fastSass('src', output); /** Alias for mix.standaloneSass(). **/
mix.less(src, output);
mix.stylus(src, output);
mix.postCss(src, output, [require('postcss-some-plugin')()]);
{% if items|length > 0 %}
{% set rnd = "best-seller" ~random() %}
<div class="mov_bseller">
<h3>{{"BEST SELLER"|trans}}</h3>
<div id="{{rnd}}" class="carousel slide" data-ride="carousel">
<!-- Wrapper for slides -->
<div class="carousel-inner">
{% for item in items %}
<div class="item {{loop.first?"active":""}}" style="text-align:center;">
<img style="padding: 2px;" alt="{{ item.product.imageMainLabel|raw }}" src="{{ movent_media_public_url(item.product.imageMain, 'image_395x527') }}" width="195" height="327" />
{% if items|length > 0 %}
{% set rnd = "best-seller" ~random() %}
<div class="mov_bseller">
<h3>{{"BEST SELLER"|trans}}</h3>
<div id="{{rnd}}" class="carousel slide" data-ride="carousel">
<!-- Wrapper for slides -->
<div class="carousel-inner">
{% for item in items %}
<div class="item {{loop.first?"active":""}}" style="text-align:center;">
<img style="padding: 2px;" alt="{{ item.product.imageMainLabel|raw }}" src="{{ movent_media_public_url(item.product.imageMain, 'image_395x527') }}" width="195" height="327" />
{#<ul>
<li id="icon-fb"><a href="{{ sahabat_nestle_fb_url }}">Sahabat Nestle</a></li>
<li id="icon-tweet"><a href="{{ sahabat_nestle_tw_url }}">@sahabatnestle</a></li>#}
{#% if brand|length > 0 %}
<li id="circles" class="btntrigger"><img src="{{ asset('bundles/moventsite/css/images/circles.png') }}"/></li>
{% endif %#}
{#</ul>
<div class="searchbar">
{% if brands|length > 0 %}
<ul>
<?php
namespace Movent\ContentBundle\Block;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Sonata\AdminBundle\Form\FormMapper;
//use Sonata\AdminBundle\Validator\ErrorElement;
use Sonata\CoreBundle\Validator\ErrorElement;
{% extends 'MoventContentBundle:Content/Layout/base:base.html.twig' %}
{% block content_top %}
<div id="article-{{ object.id }}" class="recipe-header">
<div class="recipe-header-breadcrumbs">
{{ sonata_block_render_event('breadcrumb', { 'context': 'content_view', 'category': category}) }}
</div>
</div>
{% endblock %}
<?php
namespace Movent\ContentBundle\Block;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Sonata\AdminBundle\Form\FormMapper;
//use Sonata\AdminBundle\Validator\ErrorElement;
use Sonata\CoreBundle\Validator\ErrorElement;
{% extends 'MoventContentBundle:Content/Layout/base:base.html.twig' %}
{% block content %}
{% include "MoventSiteBundle:Social:socialinit.html.twig" %}
<div class="main innerpage">
<div class="wrapper-center">
<div id="product-{{ object.id }}" class="productdetail">
<div class="recipe-header-breadcrumbs">
{{ sonata_block_render_event('breadcrumb', { 'context': 'content_view', 'category': category}) }}
</div>
....
public function itemproductAction(Request $request)
{
$contentId = $request->get('content_id');
$categoryId = $request->get('category_id');
$isDefault = $request->get('is_default', false);
$isMini = $request->get('is_mini', false);
$category = null;