Device factory, repository
This commit is contained in:
21
app/Domain/Device/Factories/DeviceFactory.php
Normal file
21
app/Domain/Device/Factories/DeviceFactory.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Device\Factories;
|
||||
|
||||
use App\Models\Device;
|
||||
|
||||
/**
|
||||
* Class DeviceFactory
|
||||
* @package App\Domain\Device\Factories
|
||||
*/
|
||||
class DeviceFactory
|
||||
{
|
||||
public function create(string $name, ?string $description = null): Device
|
||||
{
|
||||
return Device::create([
|
||||
'name' => $name,
|
||||
'description' => $description
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
12
app/Domain/Device/Repositories/DeviceRepository.php
Normal file
12
app/Domain/Device/Repositories/DeviceRepository.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Device\Repositories;
|
||||
|
||||
/**
|
||||
* Class DeviceRepository
|
||||
* @package App\Domain\Device\Repositories
|
||||
*/
|
||||
class DeviceRepository
|
||||
{
|
||||
|
||||
}
|
13
app/Models/Device.php
Normal file
13
app/Models/Device.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Device extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = ['name', 'description'];
|
||||
}
|
Reference in New Issue
Block a user