File tree Expand file tree Collapse file tree 4 files changed +59
-0
lines changed
src/Picqer/Financials/Moneybird Expand file tree Collapse file tree 4 files changed +59
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Picqer \Financials \Moneybird \Entities ;
4+
5+ use Picqer \Financials \Moneybird \Actions \FindAll ;
6+ use Picqer \Financials \Moneybird \Actions \FindOne ;
7+ use Picqer \Financials \Moneybird \Actions \Removable ;
8+ use Picqer \Financials \Moneybird \Actions \Storable ;
9+ use Picqer \Financials \Moneybird \Model ;
10+
11+ /**
12+ * Class Project.
13+ */
14+ class Project extends Model
15+ {
16+ use FindAll, FindOne, Storable, Removable;
17+
18+ /**
19+ * @var array
20+ */
21+ protected $ fillable = [
22+ 'id ' ,
23+ 'name ' ,
24+ 'state ' ,
25+ ];
26+
27+ /**
28+ * @var string
29+ */
30+ protected $ endpoint = 'projects ' ;
31+ }
Original file line number Diff line number Diff line change @@ -18,12 +18,15 @@ class TimeEntry extends Model
1818 protected $ fillable = [
1919 'id ' ,
2020 'user_id ' ,
21+ 'user ' ,
2122 'started_at ' ,
2223 'ended_at ' ,
2324 'paused_duration ' ,
2425 'contact_id ' ,
2526 'project_id ' ,
27+ 'project ' ,
2628 'detail_id ' ,
29+ 'detail ' ,
2730 'description ' ,
2831 'billable ' ,
2932 ];
@@ -37,4 +40,13 @@ class TimeEntry extends Model
3740 * @var string
3841 */
3942 protected $ namespace = 'time_entry ' ;
43+
44+ /**
45+ * @var array
46+ */
47+ protected $ singleNestedEntities = [
48+ 'user ' => User::class,
49+ 'project ' => Project::class,
50+ 'detail ' => SalesInvoiceDetail::class,
51+ ];
4052}
Original file line number Diff line number Diff line change 2222use Picqer \Financials \Moneybird \Entities \LedgerAccount ;
2323use Picqer \Financials \Moneybird \Entities \Note ;
2424use Picqer \Financials \Moneybird \Entities \Product ;
25+ use Picqer \Financials \Moneybird \Entities \Project ;
2526use Picqer \Financials \Moneybird \Entities \PurchaseInvoice ;
2627use Picqer \Financials \Moneybird \Entities \PurchaseInvoiceDetail ;
2728use Picqer \Financials \Moneybird \Entities \PurchaseInvoicePayment ;
@@ -254,6 +255,15 @@ public function product($attributes = [])
254255 return new Product ($ this ->connection , $ attributes );
255256 }
256257
258+ /**
259+ * @param array $attributes
260+ * @return \Picqer\Financials\Moneybird\Entities\Project
261+ */
262+ public function project ($ attributes = [])
263+ {
264+ return new Project ($ this ->connection , $ attributes );
265+ }
266+
257267 /**
258268 * @param array $attributes
259269 * @return \Picqer\Financials\Moneybird\Entities\PurchaseInvoice
Original file line number Diff line number Diff line change 1818use Picqer \Financials \Moneybird \Entities \LedgerAccount ;
1919use Picqer \Financials \Moneybird \Entities \Note ;
2020use Picqer \Financials \Moneybird \Entities \Product ;
21+ use Picqer \Financials \Moneybird \Entities \Project ;
2122use Picqer \Financials \Moneybird \Entities \PurchaseInvoice ;
2223use Picqer \Financials \Moneybird \Entities \PurchaseInvoiceDetail ;
2324use Picqer \Financials \Moneybird \Entities \Receipt ;
@@ -133,6 +134,11 @@ public function testProductEntity()
133134 $ this ->performEntityTest (Product::class);
134135 }
135136
137+ public function testProjectEntity ()
138+ {
139+ $ this ->performEntityTest (Project::class);
140+ }
141+
136142 public function testPurchaseInvoiceEntity ()
137143 {
138144 $ this ->performEntityTest (PurchaseInvoice::class);
You can’t perform that action at this time.
0 commit comments