Closed mohaphez closed 6 months ago
Modification to DataSource Contract
Added a piece of necessary code (use Illuminate\Database\Eloquent\Builder;
) in Contracts/DataSource.php
to enable advanced interaction with our database.
Enhancement to DataSource Contract
Added a new function (public function getQuery(): Builder
) to Contracts/DataSource.php
. This method will allow the application to make more specific and efficient interactions with our database.
Refactoring FieldsContract
Updated the method of accessing data in Fields/FieldsContract.php
, shifting from using getModel()
to the newly added getQuery()
. This makes data access more streamlined and efficient.
Added Builder capability to stub
The stubs/ZeusDataSources.stub
now also includes the ability to interact with the database in advanced ways (use Illuminate\Database\Eloquent\Builder;
).
Enhancement to stub
A similar function to make specific database interactions (public function getQuery(): Builder
) was added to stubs/ZeusDataSources.stub
to ensure it has the same capabilities as our primary modules.
I also introduced the Collection data type, enabling users to utilize data as a collection. For instance, a list of items from an enum can be utilized as a feed.
public function getQuery(): Builder|Collection
{
return collect(LanguageEnum::getAllValuesWithLabel());
}
thank you @mohaphez, really appreciate your work
what if we implement the getQuery
to the DataSourceContract
so there wont be any breaking changes, I think :)
can you test that.
thank you again.
Hi dear @atmonshi,
You're absolutely right! That's an excellent point.
I've removed getQuery
from ZeuseDataSource.stub
and added it to DataSourceContract
.
Additionally, I've replaced getModel
with getQuery
in getCollectionsValuesForResponse
within FieldsContract
.
Thanks.
Caution: This may result in breaking changes in certain programs.