mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Add CheckoutAcceptance factory
This commit is contained in:
parent
914b2658cc
commit
f96d8fe674
|
@ -3,13 +3,14 @@
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
|
||||||
class CheckoutAcceptance extends Model
|
class CheckoutAcceptance extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes, Notifiable;
|
use HasFactory, SoftDeletes, Notifiable;
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'accepted_at' => 'datetime',
|
'accepted_at' => 'datetime',
|
||||||
|
|
41
database/factories/CheckoutAcceptanceFactory.php
Normal file
41
database/factories/CheckoutAcceptanceFactory.php
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use App\Models\Accessory;
|
||||||
|
use App\Models\Asset;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
class CheckoutAcceptanceFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function definition()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'checkoutable_type' => Asset::class,
|
||||||
|
'checkoutable_id' => Asset::factory(),
|
||||||
|
'assigned_to_id' => User::factory(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function forAccessory()
|
||||||
|
{
|
||||||
|
return $this->state([
|
||||||
|
'checkoutable_type' => Accessory::class,
|
||||||
|
'checkoutable_id' => Accessory::factory(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function pending()
|
||||||
|
{
|
||||||
|
return $this->state([
|
||||||
|
'accepted_at' => null,
|
||||||
|
'declined_at' => null,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue