This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$currencies = array('code' => | |
array('code' =>'AFN' , 'name' => 'Afghani', 'symbol' => '؋' ), | |
array('code' =>'ALL' , 'name' => 'Lek', 'symbol' => 'Lek' ), | |
array('code' =>'ANG' , 'name' => 'Netherlands Antillian Guilder', 'symbol' => 'ƒ' ), | |
array('code' =>'ARS' , 'name' => 'Argentine Peso', 'symbol' => '$' ), | |
array('code' =>'AUD' , 'name' => 'Australian Dollar', 'symbol' => '$' ), | |
array('code' =>'AWG' , 'name' => 'Aruban Guilder', 'symbol' => 'ƒ' ), | |
array('code' =>'AZN' , 'name' => 'Azerbaijanian Manat', 'symbol' => 'ман' ), | |
array('code' =>'BAM' , 'name' => 'Convertible Marks', 'symbol' => 'KM' ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let products = [ | |
{ name: "Apple", type: "fruit" }, | |
{ name: "Monitor", type: "computer" }, | |
{ name: "Mango", type: "fruit" }, | |
{ name: "Table", type: "furniture" } | |
]; | |
console.log( | |
products.every(product => product.type === "fruit") //false | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let numbers = [1,3,4,2]; | |
let evenNumber = numbers.find(number => { | |
return number % 2 == 0; | |
}); | |
console.log(evenNumber); | |
/* Output : | |
4 | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let peoples = [ | |
{ | |
name : "Andi", | |
gender : "male" | |
}, | |
{ | |
name : "Siti", | |
gender : "female" | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let decimals = [10.2, 11.5, 12.3]; | |
let roundedDecimals = decimals.map(decimal => { | |
return Math.round(decimal); | |
}); | |
console.log(roundedDecimals); | |
/* Output : | |
[10, 12, 12] | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let numbers = [10, 20, 30]; | |
numbers.forEach(number => { | |
console.log(number); | |
}); | |
/* Output : | |
10 | |
20 | |
30 | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\API; | |
class BarangController extends BaseAPIController | |
{ | |
public function __construct(){ | |
$model_name = "App\Models\Barang"; | |
self::$model = new $model_name; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\API; | |
use Illuminate\Http\Request; | |
use App\Http\Controllers\Controller; | |
use Validator; | |
use App\Helpers\MessagesConstants; | |
class BaseAPIController extends Controller |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models; | |
use Illuminate\Database\Eloquent\Model; | |
class Category extends Model | |
{ | |
protected $with = ["sub_categories"]; | |
public function sub_categories(){ | |
return $this->hasMany("App\Models\Category", "parent_id", "id"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
use App\Models\Category; | |
class CategoryController extends Controller | |
{ | |
public function index() |
NewerOlder