Skip to content

Commit 1166490

Browse files
committed
Methods that Elasticquent assumes will be implemented by, and inherited from, Eloquent.
1 parent cd283b3 commit 1166490

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

src/ElasticquentTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
trait ElasticquentTrait
1414
{
15-
use ElasticquentClientTrait;
15+
use ElasticquentClientTrait, EloquentMethods;
1616

1717
/**
1818
* Uses Timestamps In Index

src/EloquentMethods.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Elasticquent;
4+
5+
trait EloquentMethods
6+
{
7+
/**
8+
* Convert the model instance to an array.
9+
*/
10+
abstract public function toArray();
11+
12+
/**
13+
* Get the value of the model's primary key.
14+
*/
15+
abstract public function getKey();
16+
17+
/**
18+
* Get the table associated with the model.
19+
*/
20+
abstract public function getTable();
21+
22+
/**
23+
* Create a new instance of the given model.
24+
*
25+
* @param array $attributes
26+
* @param bool $exists
27+
*/
28+
abstract public function newInstance($attributes =[], $exists = false);
29+
30+
/**
31+
* Get a new query builder for the model's table.
32+
*/
33+
abstract public function newQuery();
34+
}

0 commit comments

Comments
 (0)