Skip to content

Instantly share code, notes, and snippets.

View DarkGhostHunter's full-sized avatar

Italo DarkGhostHunter

View GitHub Profile
@DarkGhostHunter
DarkGhostHunter / ServiceProviderTest.php
Created December 11, 2018 03:03
Test if a file gets published
<?php
namespace Tests;
use MyVendor\MyPackage\MyClass;
use Orchestra\Testbench\TestCase;
class MyPackageServiceProviderTest extends TestCase
{
<?php
namespace Test\Assertions;
/**
* Trait AssertSJson
* @package Test\Assertions
*
* @mixin \PHPUnit\Framework\TestCase
*/
@DarkGhostHunter
DarkGhostHunter / ec485197b66e-AssertsJsonTest.php
Last active March 11, 2019 20:43
Testing a new assertion
<?php
namespace Tests;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\AssertionFailedError;
class AssertsJsonTest extends TestCase
{
use Assertions\AssertsJson;
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\User;
use App\Notifications\EmailChangeNotification;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Notification;
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\AnonymousNotifiable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\URL;
<?php
namespace App\Scopes;
use Illuminate\Database\Eloquent\Scope;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
class SelectConstraintScope implements Scope
{
@DarkGhostHunter
DarkGhostHunter / 9f2b93cf6795-migration.php
Created March 26, 2019 19:45
Create Podcast Table Migration
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePodcastTable extends Migration
{
/**
* Run the migrations.
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Podcast extends Model
{
/**
* The attributes that should be hidden for arrays.
@DarkGhostHunter
DarkGhostHunter / 4cd594ba462f-SetCacheHeaders.php
Created April 7, 2019 03:45
Laravel: The hidden SetCacheHeaders Middleware - File 1
<?php
namespace Illuminate\Http\Middleware;
use Closure;
class SetCacheHeaders
{
/**
* Add cache related HTTP headers.
@DarkGhostHunter
DarkGhostHunter / 18b3995c4874-AuthServiceProvider.php
Last active April 19, 2019 05:45
Laravel: Understanding the Authentication Guard [Part 4] - Example 1
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**