1. Go to this page and download the library: Download tharindu/facade_generator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tharindu / facade_generator example snippets
namespace Domain\Services\UserService;
use App\Models\User;
class UserService
{
protected $user;
public function __construct()
{
$this->user = new User();
}
public function get(int $user_id)
{
return $this->user->find($user_id);
}
public function create(array $data)
{
return $this->user->create($data);
}
public function read($id)
{
// Implement read functionality
}
protected function edit(User $user, array $data)
{
return array_merge($user->toArray(), $data);
}
public function update($user_id , array $data)
{
$user = $this->user->find($user_id);
return $user->update($this->edit($user, $data));
}
public function delete($id)
{
$user = $this->user->find($id);
return $user->delete();
}
public function list()
{
return $this->user->all();
}
}
bash
php artisan make:domain User
bash
composer dump-autoload
bash
php artisan make:domain User
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.