Skip to content

Instantly share code, notes, and snippets.

View marufsharia's full-sized avatar
🎯
Focusing

Abdullah Al Maruf marufsharia

🎯
Focusing
View GitHub Profile
@marufsharia
marufsharia / WithAggregate.php
Created October 24, 2023 19:09 — forked from MrPunyapal/WithAggregate.php
🚀 Laravel Tip: Optimize Queries with withAggregate 📊
<?php
// In the Post model
class Post extends Model
{
public function user()
{
return $this->belongsTo(User::class);
}
}
@marufsharia
marufsharia / livewire-select2-blade.php
Created August 29, 2022 10:03 — forked from denizozturk/livewire-select2-blade.php
Select2 example with Livewire
<!-- Make sure jquery.js, Select2.js and Select2.css files are included (in master.blade.php or another template file) -->
<div>
<div wire:ignore>
<select class="select_country" wire:model="country">
<option value="" disabled>Please select the country</option>
@isset($this->countries)
@foreach(json_decode(json_encode($this->countries)) as $country)
<option value="{{ $country->code }}">{{ $country->name }}</option>
@ashishakya
ashishakya / UserPagination.php
Last active August 27, 2022 02:43
Laravel livewire datatables look alike component
<?php
namespace App\Http\Livewire;
use App\SOSC\Models\User;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Pagination\Paginator;
use Illuminate\View\View;
use Livewire\Component;
@chatrjr
chatrjr / footer.php
Created December 17, 2012 11:45
Quick WordPress Conversion Tutorial