Skip to content

Instantly share code, notes, and snippets.

@Lelectrolux
Lelectrolux / ReadMe.md
Last active August 3, 2016 13:55
testing priority in laravel routing
@Lelectrolux
Lelectrolux / 2016_07_08_201754_create_region_city_hotel_table.php
Last active August 3, 2016 13:52
[Laravel] implicit model binding in controller
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateRegionCityHotelTable extends Migration
{
/**
* Run the migrations.
*
@Lelectrolux
Lelectrolux / Readme.md
Last active August 16, 2016 23:09
Collection of packages to start a fresh install of Laravel 5

First, I'm happy to delete the following or move it to a gist if it doesn't belong here, but I think some real life example/use case might be a good idea. I will answer question if you have any.


I got a few places where this feature would be handy. I run an app where we have a bunch of stuff (Hotel/Restaurant/Shop/Activity) classified by Region (Like US State if it speaks more to you) then City.

Here is a stripped down example.


Routes
@Lelectrolux
Lelectrolux / Readme.md
Last active February 8, 2018 20:18
lastInteraction relation

First, I'm french, sleep deprived, the last thing I want is to appear smug or passive aggressive because my english isn't good enough.

In yesterday's Advanced Querying with Eloquent talk (which was very good), you defined a lastInteraction relation like this :

public function lastInteraction()
{
    return $this->hasOne(Interaction::class, 'id', 'last_interaction_id');
}

public function scopeWithLastInteraction($query)

@Lelectrolux
Lelectrolux / FormTest.php
Last active October 15, 2020 16:55
Testing forms validation errors in laravel
<?php
namespace Tests\Feature;
use App\Models\Model;
use Generator;
use Illuminate\Foundation\Testing\RefreshDatabase;
// use Illuminate\Support\Facades\Mail;
use Tests\TestCase;
@Lelectrolux
Lelectrolux / FileInput.vue
Created September 11, 2019 06:05
FileInput
<usage>
<div class="h-64"> <!-- Set dimensions here -->
<FileInput v-model="file"/>
</div>
</usage>
<template>
<label
class="flex justify-center items-center relative rounded-lg overflow-hidden bg-gray-300 w-full h-full"
>
@Lelectrolux
Lelectrolux / README.md
Last active February 6, 2024 10:07
Tailwindcss breakpoint inspector, initial idea from https://gist.github.com/jonsugar/6bce22bd7d3673294caad36046c2b7cb

Tailwindcss plugin that adds a small box in the lower right corner of the screen showing the current breakpoint

Uses a position: fixed after css pseudo element on the body, so no extra markeup, and it get the breakpoint list by itself.

<script>
export default {
render() {
return this.$scopedSlots.default({
update: this.update,
data: this.$data.data
})
},
props: ['initialData', 'created', 'mounted'],
data() {
@Lelectrolux
Lelectrolux / List.vue
Created December 17, 2019 15:07 — forked from Akryum/List.vue
Vue - onScrollBottom composable function
<script>
import { ref } from '@vue/composition-api'
import { onScrollBottom } from '@/scroll'
export default {
setup () {
function loadMore () {
// ...
}