Skip to content

Commit bfa6828

Browse files
committed
Added the HasNew trait
1 parent 1147936 commit bfa6828

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Unreleased
2+
3+
# v.1.1
4+
5+
**Release date**: 2023-04-30
6+
7+
- HasNew: Returns a new instance of the class that uses the trait.
8+
9+
# v1.0
10+
11+
**Release date**: 2023-03-28
12+
13+
- HasPrefix trait. Use it to add a prefix to tables.

src/Contracts/HasNew.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Illegal\LaravelUtils\Contracts;
4+
5+
trait HasNew
6+
{
7+
/**
8+
* Return a new instance of the class
9+
*/
10+
public static function new(): self
11+
{
12+
return new static();
13+
}
14+
}

0 commit comments

Comments
 (0)