Skip to content

Instantly share code, notes, and snippets.

View Elshaden's full-sized avatar

Salah Elabbar Elshaden

View GitHub Profile
<?php
namespace API\Controllers;
use App\Models\User;
use DB;
use Exception;
use Laravel\Passport\Http\Controllers\AccessTokenController as ATC;
use Laravel\Passport\Http\Controllers\HandlesOAuthErrors;
use Laravel\Passport\TokenRepository;
@Elshaden
Elshaden / gist:148c77e7397fe768161c46575e832a65
Last active May 19, 2022 17:42
Spatie Livewire Wizard blade Component
{{-- Use as A blade omponent in all Steps Views--}}
{{-- <div>--}}
{{-- <x-wizard-view-component :steps="$steps" >--}}
{{-- Welcome Slotted--}}
{{-- </x-wizard-view-component>--}}
{{-- </div>--}}
{{-- That Should do it all --}}
<div>
@Elshaden
Elshaden / LivewireFilickity.blade.php
Last active December 18, 2023 05:36
Flickity Laravel Livewire Implementation Example
@push('css')
<link rel="stylesheet" href="https://unpkg.com/flickity@2/dist/flickity.min.css">
<style>
/* external css: flickity.css */
* {
box-sizing: border-box;
}
@Elshaden
Elshaden / gist:f886cd0595e1562a9c1e5c1f5b66f682
Created February 17, 2021 07:37
Convert Paginated API Response to standard Laravel Paginated collection
/*
* This class is used to convert any API Response which has pagination into standrad Laravel Pagination collection
* to use it
* $PaginatedResponse = PaginateApiResponsne::paginate($YourAPIResponse);
* You will need to change the parameteres in the functin to match your Api response Pagination parameters
*
*/
use Illuminate\Container\Container;
use Illuminate\Pagination\LengthAwarePaginator;
@Elshaden
Elshaden / gist:843cc70f23b369b2c11407a6f73fb24c
Last active February 7, 2021 01:18
Toggle Dark Mode with Tailwind css. and Livewire
<script>
// This script should be placed in the main layout file ( layouts.app )
// You need to create Livewire component in this case called Theme,
//
// you only need to set the listener to 'ModeView' see gist of this component
// Initial load of the page
@Elshaden
Elshaden / xmlToarray
Created November 17, 2020 23:05
This class converts any XML input to array by calling the function buildArray($inputXml)
class Xml2ArrayClass
{
/**
* The name of the XML attribute that indicates a namespace definition
*/
const ATTRIBUTE_NAMESPACE = 'xmlns';
/**
* The string that separates the namespace attribute from the prefix for the namespace
*/
@Elshaden
Elshaden / EncryptCast.php
Created November 8, 2020 07:58
Encrypt any Field in Database , using setter and getter in Laravel model implemented as cast
namespace App\Models\Casts;
/*
* Usage
*
* First use the Class
*
* use App\Models\Casts\EncryptCast;
*
*
*
<?php
namespace App\Containers\Authentication\Actions;
use Symfony\Component\HttpFoundation\IpUtils;
class IpWhiteList
{

Keybase proof

I hereby claim:

  • I am elshaden on github.
  • I am salahabbar (https://keybase.io/salahabbar) on keybase.
  • I have a public key ASDTAWKW4LGqsTadk3m0E2bCa_b6XD_sB1zcbEdBEhm9Hwo

To claim this, I am signing this object: