Skip to content

Instantly share code, notes, and snippets.

<?php
class UniqueId {
private $id;
public function __construct($prefix = '')
{
$this->id = uniqid($prefix, true);
}

Setup

I simply created two apps using latest version of each framework, using: laravel new laravel lumen new lumen`

I added a route to each (on /) both simply returning 'ok'. Of cause, I added the route to Laravels API routes.

Command used to test

<head>
<style>
body {
min-height: 100vh;
background: #ffffff;
background: -moz-linear-gradient(top, #ffffff 0%, #000000 100%);
background: -webkit-linear-gradient(top, #ffffff 0%,#000000 100%);
background: linear-gradient(to bottom, #ffffff 0%,#000000 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#000000',GradientType=0 );

app.js

This file is added ABOVE all other scripts in the HTML

window.$ = window.jQuery = require('jquery');

home.js

This file is loaded below app.js (as stated above)

$("body").html('Testing');
const {mix} = require('laravel-mix');
mix.js('js/app.js', 'public/js')
.sass('sass/app.sass', 'public/css');
{
"private": true,
"scripts": {
"dev": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"dependencies": {
"cross-env": "^3.2.3",
<?php
if (! function_exists('mix')) {
/**
* Get the path to a versioned Mix file.
*
* @param string $path
* @param string $manifestDirectory
* @return \Illuminate\Support\HtmlString
*
* @throws \Exception
<?php
require_once 'vendor/autoload.php';
require_once 'mix.php';
?>
<!DOCTYPE html>
<html>
<head>
</head>
<title>Demo</title>
<link rel="stylesheet" href="<?php echo mix('public/css/app.css'); ?>" />
@LasseRafn
LasseRafn / webpack.mix.js
Created March 8, 2017 14:01
With versioning
const {mix} = require('laravel-mix');
mix.js('js/app.js', 'public/js')
.sass('sass/app.sass', 'public/css')
.version();
#login {
position: absolute;
left: 50%;
top: 50%;
margin-left: -150px; /* halvdelen af input bredden */
margin-top: -34px; /* halvdelen af input højde x 2 + input margin-bottom */
}
/* eller bare brug flexbox */
body {