Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ vendor
/stubs/node_modules
stubs/package-lock.json
/node_modules
/build/
.phpunit.result.cache
/public/build/
/workbench/storage
/workbench/database/database.sqlite
25 changes: 22 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
"Tests\\": "tests/",
"Workbench\\App\\": "workbench/app/",
"Workbench\\Database\\Factories\\": "workbench/database/factories/",
"Workbench\\Database\\Seeders\\": "workbench/database/seeders/"
}
},
"authors": [
Expand All @@ -36,7 +39,23 @@
}
],
"scripts": {
"lint": "vendor/bin/pint"
"lint": "vendor/bin/pint",
"post-autoload-dump": [
"@clear",
"@prepare"
],
"clear": "@php vendor/bin/testbench package:purge-skeleton --ansi",
"prepare": "@php vendor/bin/testbench package:discover --ansi",
"build": "@php vendor/bin/testbench workbench:build --ansi",
"serve": [
"Composer\\Config::disableProcessTimeout",
"@build",
"@php vendor/bin/testbench serve --ansi"
],
"test": [
"@clear",
"@php vendor/bin/phpunit"
]
},
"extra": {
"laravel": {
Expand All @@ -46,4 +65,4 @@
}
},
"minimum-stability": "stable"
}
}
6 changes: 3 additions & 3 deletions stubs/api/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* Here is the serverless function entry
* for deployment with Vercel.
*/
* Here is the serverless function entry
* for deployment with Vercel.
*/
require __DIR__.'/../public/index.php';
37 changes: 37 additions & 0 deletions testbench.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
laravel: '@testbench'

providers:
# - Workbench\App\Providers\WorkbenchServiceProvider
- Revolution\Ordering\Providers\OrderingServiceProvider

Comment thread
kawax marked this conversation as resolved.
migrations:
- workbench/database/migrations

seeders:
- Workbench\Database\Seeders\DatabaseSeeder

workbench:
start: '/'
install: true
health: false
discovers:
web: true
api: true
commands: true
components: false
factories: true
views: false
build:
- asset-publish
- create-sqlite-db
- db-wipe
- migrate-fresh
assets:
- laravel-assets
sync:
Comment thread
kawax marked this conversation as resolved.
- from: storage
to: workbench/storage
reverse: true
- from: public/build
to: workbench/public/build
reverse: true
Empty file added workbench/app/Models/.gitkeep
Empty file.
48 changes: 48 additions & 0 deletions workbench/app/Models/User.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

namespace Workbench\App\Models;

// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
/** @use HasFactory<\Workbench\Database\Factories\UserFactory> */
use HasFactory, Notifiable;

/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
];

/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];

/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}
24 changes: 24 additions & 0 deletions workbench/app/Providers/WorkbenchServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Workbench\App\Providers;

use Illuminate\Support\ServiceProvider;

class WorkbenchServiceProvider extends ServiceProvider
{
/**
* Register services.
*/
public function register(): void
{
//
}

/**
* Bootstrap services.
*/
public function boot(): void
{
//
}
}
19 changes: 19 additions & 0 deletions workbench/bootstrap/app.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;

use function Orchestra\Testbench\default_skeleton_path;

return Application::configure(basePath: $APP_BASE_PATH ?? default_skeleton_path())
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
)
->withMiddleware(function (Middleware $middleware) {
//
})
->withExceptions(function (Exceptions $exceptions) {
//
})->create();
Empty file.
54 changes: 54 additions & 0 deletions workbench/database/factories/UserFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

namespace Workbench\Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use Workbench\App\Models\User;

/**
* @template TModel of \Workbench\App\Models\User
*
* @extends \Illuminate\Database\Eloquent\Factories\Factory<TModel>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;

/**
* The name of the factory's corresponding model.
*
* @var class-string<TModel>
*/
protected $model = User::class;

/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
];
}

/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}
Empty file.
23 changes: 23 additions & 0 deletions workbench/database/seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Workbench\Database\Seeders;

use Illuminate\Database\Seeder;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Workbench\Database\Factories\UserFactory;

class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
// UserFactory::new()->times(10)->create();

UserFactory::new()->create([
'name' => 'Test User',
'email' => 'test@example.com',
]);
}
}
Empty file.
8 changes: 8 additions & 0 deletions workbench/routes/console.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;

// Artisan::command('inspire', function () {
// $this->comment(Inspiring::quote());
// })->purpose('Display an inspiring quote');
7 changes: 7 additions & 0 deletions workbench/routes/web.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

use Illuminate\Support\Facades\Route;

Route::get('/', function () {
return view('welcome');
});