Skip to content

Instantly share code, notes, and snippets.

View jalallinux's full-sized avatar
🌵
ABC: Always Be Coding

JalalLinuX jalallinux

🌵
ABC: Always Be Coding
View GitHub Profile
@jalallinux
jalallinux / observer.stub
Last active October 8, 2022 12:48
Laravel - Observer Stub
<?php
namespace {{ namespace }};
use {{ namespacedModel }};
class {{ class }}
{
/**
* Handle the {{ model }} "creating" event.
@jalallinux
jalallinux / controller.model.api.stub
Created October 8, 2022 12:47
Laravel - Controller Model API Stub
<?php
namespace {{ namespace }};
use {{ rootNamespace }}Http\Controllers\Controller;
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
use Illuminate\Http\JsonResponse;
use App\Repository\Contracts\{{ model }}Contract;
/**
@jalallinux
jalallinux / Handler.php
Last active March 5, 2022 10:45
Laravel: Convert validation rules exception to another exception
<?php
namespace App\Exceptions;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Validation\ValidationException;
@jalallinux
jalallinux / WithUuidColumn.php
Last active March 5, 2022 07:52
Laravel: Use uuid column separately
<?php
namespace App\Models\Traits;
use Illuminate\Database\Eloquent\Model;
trait WithUuidColumn
{
protected static function bootWithUuidColumn()
{
@jalallinux
jalallinux / postman-performance-test.js
Last active March 28, 2022 06:29
Postman: Performance Test
pm.test("Successful request", function () {
pm.expect(pm.response.code).to.be.oneOf([200, 201, 202]);
});
pm.test("Response time is less than 217ms.", function () {
pm.expect(pm.response.responseTime).to.be.below(217);
});
pm.test("Response time is less than 317ms", function () {
pm.expect(pm.response.responseTime).to.be.below(317);
@jalallinux
jalallinux / BaseEloquentRepository.php
Last active March 5, 2022 07:53
Laravel: Base Repository Pattern
<?php
namespace App\Repositories\Eloquent;
use App\Repositories\BaseRepository;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
@jalallinux
jalallinux / UseUuidPrimary.php
Last active March 5, 2022 07:53
Laravel: UseUuid trait
<?php
namespace App\Models\Traits;
use Illuminate\Database\Eloquent\Model;
trait UseUuidPrimary
{
protected static function bootUseUuidPrimary()
{

Keybase proof

I hereby claim:

  • I am jalallinux on github.
  • I am jalal_linux (https://keybase.io/jalal_linux) on keybase.
  • I have a public key ASDRExI2P8_-cR9w_IPe9_s0y9GxhNiI_FC900bytqRLFwo

To claim this, I am signing this object: