Skip to content

Instantly share code, notes, and snippets.

<?php
return [
...
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
<?php
namespace App\Providers;
use App\Services\UPS;
use UPS\Client;
use Illuminate\Support\ServiceProvider;
class UPSServiceProvider extends ServiceProvider
{
<?php
namespace App\Facades;
use Illuminate\Support\Facades\Facade;
class UPS extends Facade {
protected static function getFacadeAccessor() { return 'ups'; }
}
<?php
namespace App\Services;
use App\Order;
use UPS\Client;
class UPS{
<?php
namespace Tests\Feature;
use App\Cart;
use App\CartItem;
use App\Product;
use App\User;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithoutMiddleware;
<?php
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
<?php
$factory->define(\App\Product::class, function(\Faker\Generator $faker){
return [
'title'=>$faker->word,
'description'=>$faker->paragraph,
'price'=>$faker->randomFloat(),
'available'=>$faker->boolean()
];
});
<?php
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Product extends Model
{
//
}
<?php
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});