Package Data | |
---|---|
Maintainer Username: | wangchristine |
Package Create Date: | 2021-08-28 |
Package Last Update: | 2021-12-02 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-20 03:00:31 |
Package Statistics | |
---|---|
Total Downloads: | 574 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
This package extends Laravel generating commands.
Install by composer
$ composer require chhw/commander
If you are under Laravel 5.5, please add this code in config/app.php
below.
<?php
'providers' => [
CHHW\Commander\CommanderServiceProvider::class,
],
?>
In bootstrap/app.php
, you should:
$app->withEloquent();
$app->register(CHHW\Commander\CommanderServiceProvider::class);
And add config/database.php
just like Laravel.
Create a new service class.
$ php artisan make:service UserService
Create a new repository class.
$ php artisan make:repository UserRepository
Or you can create a new repository class with
--model=
$ php artisan make:repository UserRepository --model=User
You can use these methods in service:
app/Services/UserService.php
protected $userRepository;
public function __construct(UserRepository $repository)
{
$this->userRepository = $repository;
}
public function getAll()
{
return $this->userRepository->all();
}