Skip to content

Instantly share code, notes, and snippets.

View oliuz's full-sized avatar
💻
Coding!

Jose Rosado oliuz

💻
Coding!
View GitHub Profile
@oliuz
oliuz / Calendar.php
Created November 6, 2023 18:26 — forked from yelocode/Calendar.php
Full Calendar JS Livewire example
<?php
namespace App\Livewire;
use App\Models\Event;
use Carbon\Carbon;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Validator;
use Livewire\Attributes\Rule;
use Livewire\Component;
@oliuz
oliuz / Installing Laravel in a subfolder.md
Created November 6, 2023 18:26 — forked from rafaucau/Installing Laravel in a subfolder.md
Installing Laravel in a subfolder

Installing Laravel in a subfolder

Installing Laravel in a domain subfolder can be useful in certain situations, although it is not officially supported by Laravel creators. In this instruction, I will describe how to configure Laravel 10 in a subfolder and additional tools such as Livewire v3.

Table of Contents

  1. Laravel Basse
  2. Livewire
  3. Filament Panel Builder

Laravel Base

@oliuz
oliuz / LivewireComponentsFinder.php
Created November 6, 2023 18:26 — forked from jdltechworks/LivewireComponentsFinder.php
Package based livewire using Routes instead of using Livewire::component
<?php
namespace MarketDragon\LivewireExtra;
use Exception;
use ReflectionClass;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\Finder\SplFileInfo;
use Livewire\Component;
@oliuz
oliuz / ExportReportsLiveiwre.php
Created November 6, 2023 18:23 — forked from MrPunyapal/ExportReportsLiveiwre.php
Exporting CSV Reports with Renderless Livewire Component
<?php
namespace App\Http\Livewire;
use Livewire\Component;
use Livewire\Attributes\Renderless;
use App\Traits\HasFilteredReports;
class Reports extends Component
{
@oliuz
oliuz / Laravel Alpine JS Modal
Created October 25, 2023 17:16 — forked from MatinMN/Laravel Alpine JS Modal
Laravel Modal Component
// open modal from livewire component
$this->dispatch('open-modal', name: 'user-details');
// close modal
$this->dispatch('close-modal');
@oliuz
oliuz / select2.blade.php
Created September 5, 2023 11:46 — forked from jojomak13/select2.blade.php
select2 input with alpinejs and livewire
@props(['multiple' => false])
<div {{ $attributes }} wire:ignore x-data="{
value: @entangle($attributes->wire('model')),
init(){
let input = new TomSelect(this.$refs.select, {
onChange: (value) => this.value = value,
items: this.value
});
}
@oliuz
oliuz / ExampleUsage.php
Created July 29, 2023 00:03 — forked from x7ryan/ExampleUsage.php
A simple Laravel Livewire trait to include rules and messages from a Laravel FormRequest Class. Simply use this trait and define a protected property useFormRequest as a reference to the FormRequest class you wish to use. This can be used to share validation logic between livewire components and traditonal Laravel controllers, for example when u…
<?php
namespace App\Http\Livewire;
use Livewire\Component;
use App\Http\Livewire\Concerns\FormRequest;
class ExampleUsage extends Component
{
use FormRequest;
@oliuz
oliuz / 0 - Readme.md
Created July 29, 2023 00:02 — forked from lennardv2/0 - Readme.md
Make livewire components more secure by default by using these traits

Livewire Security

Make livewire components more secure by default by using these traits

This trait is used to protect public livewire properties from being changed by the user by default in frontend via Livewire JS calls. See: https://www.reddit.com/r/laravel/comments/q0qrri/livewire_extremely_insecure/

If you want to 'expose' methods and properties you must use the $callable and $mutable properties to do so. By default every property defined in $rules or rules() is considered mutable.

This trait will throw an exception if mutable and callable properties are non-existant on your component;

<?php
namespace App\Http\Livewire\Stats;
use Illuminate\Support\Facades\DB;
use Livewire\Component;
class DistanceByYear extends Component
{
public $chartId;
@oliuz
oliuz / gist:99278f00986d673de7ea047625acc13b
Created July 15, 2022 18:32 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>