| Package Data | |
|---|---|
| Maintainer Username: | bereczkybalazs |
| Maintainer Contact: | bereczkybalazs1@gmail.com (Balazs Bereczky) |
| Package Create Date: | 2021-05-20 |
| Package Last Update: | 2021-07-28 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-29 03:01:35 |
| Package Statistics | |
|---|---|
| Total Downloads: | 43 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 0 |
| Total Watchers: | 0 |
| Total Forks: | 0 |
| Total Open Issues: | 0 |
This will create a model, which will connect to the users table
use Elafries\FirestoreModel\FirestoreModel;
class User extends FirestoreModel {
}
use Elafries\FirestoreModel\FirestoreModel;
class User extends FirestoreModel {
protected array $fillable = [
'name', 'age', 'weight'
];
protected array $hidden = [
'password',
];
protected array $secure = [
'password',
];
}
fillableWhen you insert to the database these fields will be added and the secure fields ONLY!
hiddenWhen you fetch from the database, these fields will be hidden
secureWhen you insert/update the database these fields will be encrypted.
When you insert to the database, it will extend the fillable parameters.
class UserController extends Controller
{
public function __construct(private User $user) {}
}
:array$this->user->all();
:array$this->user->where('name', '=', 'test')->get();
:array$this->user
->where('name', '=', 'test')
->where('age', '>', '33')
->where('weight', '>', '110')
->get();
:array$this->user->where('name', '=', 'test')->getRaw();
:array$this->user
->where('name', '=', 'test')
->where('age', '>', '33')
->first();
:array$this->user
->where('name', '=', 'test')
->where('age', '>', '33')
->firstRaw();
:array$this->user->findById('2asd123a23a');
:array$this->user->findByIdRaw('2asd123a23a');
:int$this->user
->where('name', '=', 'test')
->where('age', '>', '33')
->count();
:bool$this->user
->where('name', '=', 'test')
->where('age', '>', '33')
->exists();
:array$this->user->create([
'name' => 'Bill Buffalo',
'age' => 43,
'weight' => 92,
'password' => 'secret'
]);
:void$this->user->updateById('2asd123a23a', [
'age' => 51,
'weight' => 97,
]);
:void$this->user
->where('name', '=', 'test')
->where('age', '>', '33')
->update([
'age' => 51,
'weight' => 97,
]);
:void$this->user
->where('name', '=', 'test')
->where('age', '>', '33')
->delete();