Skip to content

Instantly share code, notes, and snippets.

View tushargugnani's full-sized avatar

Tushar Gugnani tushargugnani

View GitHub Profile
@tushargugnani
tushargugnani / gist:ffd194a53f065bccd29e2f7041d42805
Created July 31, 2023 06:21
Livewire Parent Child Modelable Property
/*Parent Component */
<?php
namespace App\Livewire;
use Livewire\Component;
class ParentComponent extends Component
{
<?php
namespace App\Models;
use EloquentFilter\Filterable;
use Spatie\MediaLibrary\HasMedia;
use Spatie\Searchable\Searchable;
use Spatie\Searchable\SearchResult;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
@tushargugnani
tushargugnani / gist:3f8d8d3e4fe8e9f0840c2d1b4faea989
Created February 19, 2023 03:56
avatarUrl function in User model
public function avatarUrl()
{
return $this->avatar
? Storage::disk('public')->url($this->avatar)
: 'https://www.gravatar.com/avatar/' . md5(strtolower(trim($this->email)));
}
<?php
namespace App\Helper;
trait WpTrait
{
/**
* Replaces double line-breaks with paragraph elements.
<?php
namespace Tests\Browser;
use App\Page;
use Facebook\WebDriver\WebDriverBy;
use Tests\DuskTestCase;
use Laravel\Dusk\Browser;
use Illuminate\Foundation\Testing\DatabaseMigrations;
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePagesTable extends Migration
{
/**
* Run the migrations.
Route::get('profile', function () {
// Only verified users may enter...
})->middleware('verified');
Auth::routes(['verify' => true]);
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable implements MustVerifyEmail
{