Skip to content

Instantly share code, notes, and snippets.

View richardDobron's full-sized avatar
💭
🔥 making stuff faster

Richard Dobroň richardDobron

💭
🔥 making stuff faster
View GitHub Profile
@richardDobron
richardDobron / EventServiceProvider.php
Last active June 1, 2022 18:40
Automatic schema generation for ide-helper after finished migrations in Laravel.
<?php
namespace App\Providers;
use Illuminate\Database\Events\MigrationsEnded;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
@richardDobron
richardDobron / composer.json
Created July 11, 2022 17:17
Composer command that generates helper files that enable your IDE to provide accurate autocompletion. Generator: barryvdh/laravel-ide-helper
{
…,
"scripts": {
"schema": "php artisan ide-helper:models -r -W"
}
}
<?php
use App\Mail\Traits;
use Illuminate\Contracts\View\Factory as ViewFactory;
use Illuminate\Support\HtmlString;
use Soundasleep\Html2Text;
trait TextMailBuilder
{
<?php
namespace App\Mail;
use App\Mail\Traits\TextMailBuilder;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class OrderReceived extends Mailable
{
<?php
namespace App;
use fbt\Transform\FbtTransform\Translate\IntlVariations;
use fbt\Lib\IntlViewerContextInterface;
use fbt\Runtime\Gender;
class UserDTO implements IntlViewerContextInterface
{
{
...,
"scripts": {
"translate-fbts": "php ./vendor/bin/fbt translate --path=./storage/fbt --translations=./storage/fbt/*.json",
"generate-translations": "php ./vendor/bin/fbt generate-translations --source=./storage/fbt/.source_strings.json --translations=./storage/fbt/*.json"
}
}
<?php
// simple text:
echo fbt('Save', 'Button: Save a form or settings');
// text with params:
$name = 'Patricia';
$gender = 2;
echo fbt(
\fbt\fbt::name(
{
"phrases": [
{
"hashToText": {
"77515026232eb24b14cc5e7cca878637": "Save"
},
"desc": "Button: Save a form or settings",
"project": "tutorial app",
"author": "richard",
"type": "text",
{
"sk_SK": {
"fb-locale": "sk_SK",
"translations": {
"77515026232eb24b14cc5e7cca878637": {
"translations": [
{
"translation": "Uložiť",
"variations": []
}
{
"sk_SK": {
"2gTzp8": [
"Uložiť",
"77515026232eb24b14cc5e7cca878637" // phrase hash
],
"16x4nE": {
"1": [ // male
"{name} zdieľal odkaz. Dajte mu vedieť, že sa vám páči.",
"11608ffd7ee5e79d727ab00631b2c164"