Skip to content

Instantly share code, notes, and snippets.

@mkwsra
mkwsra / list-of-all-font-awesome-icons.php
Created November 28, 2019 18:09
List of All Font awesome icons for developers
<?php
return [
"fas fa-ad" => "Ad",
"fas fa-address-book" => "Address book",
"fas fa-address-card" => "Address card",
"fas fa-adjust" => "Adjust",
"fas fa-air-freshener" => "Air freshener",
"fas fa-align-center" => "Align center",
"fas fa-align-justify" => "Align justify",
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePostsTable extends Migration
{
/**
* Run the migrations.
<?php
namespace App\Models;
class Post extends Model implements HasMedia, ShouldHaveTypes
{
// ...
// Add/override the boot function
protected static function boot()
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
<?php
namespace App\Models;
// ...
// Remember to import it
use App\Traits\HasUuid;
class Post extends Model
{
<?php
namespace App\Traits;
use App\Http\Controllers\Controller;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
trait HasUuid
{
<?php
namespace App\Providers;
// Example models.
use App\Models\Post;
use App\Models\Taxonomy;
use App\Models\University;
use App\Models\LanguageInstitute;
use App\Models\Exam;
<?php
namespace App\Http\Controllers;
use App\Models\Post;
use App\Traits\HasUuid;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@mkwsra
mkwsra / HasStatuses.php
Created December 19, 2021 00:00
Laravel - Has Statuses Trait
<?php
namespace App\Traits;
use Illuminate\Database\Eloquent\Builder;
trait HasStatuses
{
const STATUS_DRAFT = 0;
const STATUS_ACTIVE = 1;
@mkwsra
mkwsra / Kernel.php
Last active January 6, 2022 21:38
Laravel middleware to store marketing related query string params
// Usage
class Kernel extends HttpKernel
{
// .....
// .....
// .....
protected $routeMiddleware = [
// .....