Skip to content

Instantly share code, notes, and snippets.

View nnivxix's full-sized avatar
🌐
web.dev

Hanasa nnivxix

🌐
web.dev
View GitHub Profile
@nnivxix
nnivxix / App.vue
Created October 19, 2024 14:43
Example ref and useTemplateRef in Vue
<script setup lang="ts">
import { ref, useTemplateRef, onMounted } from 'vue'
import Hello from "./Hello.vue"
const msg = ref('Hello World!')
const helloRef = useTemplateRef('hello');
const secondRef = ref()
onMounted(() => {
console.log(helloRef.value.$el, 'helloRef'); // <h1>
@nnivxix
nnivxix / App.vue
Created January 20, 2024 23:42
prop vs defineModel
<script setup>
import { ref } from 'vue'
import Prop from './Prop.vue';
import Model from './Model.vue';
const msg = ref('Hello World!')
function inc(value){
value++
}
@nnivxix
nnivxix / put-method.md
Last active September 24, 2023 08:37
How to using PUT Method in Laravel using Postman

PUT Method Laravel

  1. Set Route Laravel to be PUT.
  2. Headers -> Disable or uncheck "Accept" (optional).
  3. Body -> form-data then add on the last form with key and value "_method: PUT".
@nnivxix
nnivxix / update_foreignkey.php
Created September 7, 2023 10:00
UPDATE FOREIGN KEY
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
/**
@nnivxix
nnivxix / readme.md
Last active August 12, 2023 04:45
Attach, detach and sync many-to-many relationships in Laravel

Attach, detach and sync many-to-many relationships in Laravel

1.attach is insert value to pivot table relation

when we run this code $user->roles()->attach([3]); that will be add/insert data to table user_role

role_id user_id
3 1
@nnivxix
nnivxix / ObjectError.md
Last active July 18, 2022 17:10
Error Handling JavaScript

Object error

ObjectError memiliki beberapa properti utama di dalamnya, yaitu:

  1. name : Nama error yang terjadi.
  2. message : Pesan tentang detail error.
  3. stack : Informasi urutan kejadian yang menyebabkan error. Umumnya digunakan untuk debugging karena terdapat informasi baris mana yang menyebabkan error.

try-catch-finally

Blok finally akan dieksekusi mau bagaimanapun hasilnya entah gagal atau berhasil akan tetap dirender.

@nnivxix
nnivxix / github-starter.md
Last active August 20, 2023 23:51
Quick setup using github

How to get start using github

…or create a new repository on the command line

git init
git add *
git commit -m "first commit"
git branch -M main
git remote add origin [email protected]:<user>/<repository>.git
git remote set-url origin https://@github.com//.git