Skip to content

Instantly share code, notes, and snippets.

View RayhanYulanda's full-sized avatar
Working from home

Rayhan Yulanda RayhanYulanda

Working from home
View GitHub Profile
@RayhanYulanda
RayhanYulanda / ddd.md
Last active December 9, 2023 15:35
Struktur folder Laravel dengan pendekatan DDD
@RayhanYulanda
RayhanYulanda / User.php
Last active November 24, 2020 05:38
User good class
<?php
class UserRequest {
protected static $rules = [
'name' => 'string',
'email' => 'string'
];
public static function validate($data){
foreach(static::$rules as $property => $type){
if (gettype($data[$property]) != $type)
@RayhanYulanda
RayhanYulanda / User.php
Last active November 23, 2020 11:37
User bad class
<?php
class User {
public $name;
public $email;
public function __construct($data) {
$this->name = $data['name'];
$this->email = $data['email'];
}
public function formatJson() {