Skip to content

Instantly share code, notes, and snippets.

View Konafets's full-sized avatar

Stefano Kowalke Konafets

View GitHub Profile
@Konafets
Konafets / app.js
Created October 14, 2017 17:34
Setup vuex-i18n
import store from './vuex';
import vuexI18n from 'vuex-i18n';
Vue.use(vuexI18n.plugin, store);
import Locales from './vue-i18n-locales.generated.js';
Vue.i18n.add('en', Locales.en);
Vue.i18n.add('de', Locales.de);
// set the start locale to use
Vue.i18n.set('en');
@Konafets
Konafets / app.js
Last active October 14, 2017 17:22
Setup vue-i18n
import VueInternalization from 'vue-i18n';
import Locales from './vue-i18n-locales.generated.js';
Vue.use(VueInternalization);
const i18n = new VueInternalization(Locales);
import store from './vuex';
const app = new Vue({
store, // inject store into all children
<my-component
csrf-token="{{ csrf_token() }}"
:user="{{ $user }}"
update-route="{{ route('users.update', ['user' => $user]) }}"
></my-component inline-component>
@Konafets
Konafets / MyComponent.vue
Last active October 14, 2017 16:27
Working Vue Component
<template>
<div>
<h1>Edit {{ user.name }}</h1>
<form method="post" action="{{ updateRoute }}">
<input hidden name="_token" :value="csrfToken">
<input name="_method" type="hidden" value="PATCH">
<!-- Some form fields -->
<button type="submit">Update</button>
@Konafets
Konafets / MyComponent.vue
Last active October 14, 2017 17:37
Not working VueComponent
<template>
<div>
<h1>@lang('users.edit') {{ $user->name }}</h1>
<form method="post" action="{{ route('users.update', ['user' => $user]) }}">
{!! csrf_field() !!}
<input name="_method" type="hidden" value="PATCH">
<!-- Some form fields -->
<button type="submit">{{ __('button.update') }}</button>
@Konafets
Konafets / EditInlineTemplate.blade.php
Last active January 22, 2019 08:28
VueJS Inline Template in Blade
<my-component inline-template>
<h1>@lang('users.edit') {{ $user->name }}</h1>
<form method="post" action="{{ route('users.update', ['user' => $user]) }}">
{!! csrf_field() !!}
<input name="_method" type="hidden" value="PATCH">
<!-- Some form fields -->
<button type="submit">{{ __('button.update') }}</button>
</form>
@Konafets
Konafets / .gitignore
Created April 18, 2017 14:41
.gitignore for Laravel
/node_modules
/public/storage
/public/js/
/public/css/
/public/img/
/public/fonts/
/public/images/
/public/mix-manifest.json
/public/hot
/storage/*.key
@Konafets
Konafets / SettingsService.php
Last active December 7, 2016 10:34
SettingsService for TYPO3
<?php namespace ;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Reflection\ObjectAccess;
/**
* Provide a way to get the configuration just everywhere
*
* Example
@Konafets
Konafets / .editorconfig
Created July 22, 2015 19:33
PSR-2 Editorconfig file for TYPO3 7
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# All PHP files MUST use the Unix LF (linefeed) line ending.
[*]
charset = utf-8
end_of_line = lf
@Konafets
Konafets / Fluid ValidateErrorsViewHelper
Last active August 29, 2015 14:14
Fluid: ValidateErrorsViewHelper
<f:form.validationResults for="{property}">
<f:if condition="{validationResults.flattenedErrors}">
<ul class="validation-results">
<f:alias map="{lll: 'LLL:EXT:extension_key/Resources/Private/Language/locallang_errors.xlf:error'}">
<f:for each="{validationResults.errors}" as="error">
<li class="error">
<f:translate key="{lll}.{property}.{error.code}"
default="{f:translate(key:'{lll}.{property}', default:'{f:translate(key:\'{lll}.default\')}')}"/>
</li>
</f:for>