Laravel Cashier: paymentMethods()が空のobjectしか返さない

環境:

laravel@6.18.35

laravel-cashier@12.3.1

 

$paymentMethods = Auth::user()->paymentMethods()

f:id:monteecristoo:20200916205004p:plain

 

solution)

dd($paymentMethods[0])で返る以下の項目がアクセス可能なプロパティなので

f:id:monteecristoo:20200916212422p:plain

$paymentMethods[0]->card等

f:id:monteecristoo:20200916210421p:plain

もしくは、

$paymentMethods[0]->asStripePaymentMethod()

f:id:monteecristoo:20200916211001p:plain
 

ref)

laracasts.com

 

VueJs 条件付きでクリックイベントを listen する

Updated: 2020/9/2

 

APIを叩いてからボタンをクリックできるようにしたい等々

 

環境

Vue@2.6.12

 

<button @click="eventReady ? someFunc() : null">

 

computed: {

  eventReady() {

   if( // write condition ) {

     return true

   } else {

    return false

   }

  }

}

 

methods: {

  someFunc() {

 

  }

}

--------------------------------------------------------------------------------------

おまけ

三項演算子を使ったボタンのイベント条件分岐にさらに常時発火のメソッドを付加はできない。

<button @click="eventReady ? someFunc() : null & anotherFunc()">

 >>> cannot emit anotherFunc

 

ただし event modifier が必要である場合は可能

<button @click="eventReady ? someFunc() : null" @click.once="anotherFunc()">

>>> can emit anotherFunc

 

modifier が無いと click event の duplicate でエラー

<button @click="eventReady ? someFunc() : null" @click="anotherFunc()">

>>> error

 

modifier が必要ないイベントの場合、メソッドを一つにまとめてメソッド内で条件分岐を作る。

 

ref:

https://stackoverflow.com/questions/48042274/conditional-event-binding-vuejs

monteecristoo.hatenablog.com

 

Vuetify - v-dialog の v-model に vuex state を指定する方法 --- v-dialog を別のコンポーネントから制御する

updated: 2021/6/16

 

通常 v-dialog は v-model で 該当コンポーネントが保持する data の値を指定する。

それによって dialog の外側をクリックしたときに表示を toggle することができる。

ここで vuex の state を指定すると外側クリック時にコンソール上にエラーが出る。

(コンポーネントから直接 vuex state の値を変更できないため)

このエラー取りの方法に関して。

 

solution)

vuex action から v-model に指定した state の値を変更する。

<v-dialog v-model="this.$store.state.SOMETHING" persistent @click:outside="toggleDialog">

 

persistent >>> 外側クリック時の default のイベントを停止

@click:outside="toggleDialog" >>> v-model の値を変更する action をマニュアルで設定

 

vuex側 --- 詳細は割愛

'toggleDialog' (state) {

  state.SOMETHING = !state.SOMETHING

}

 

optional)

@otherComponent

<button @click="$store.dispatch('toggleDialog')"></button>

 

メリット:

v-model に vuex state を指定することで dialog の表示を別の component から操作できるようになる。

 

注意***

list rendering されたcomponentにdialogを設置し、さらにnest されたdialogを設置した場合、

f:id:monteecristoo:20210616203140p:plain

nest されたdialogは list1 のnest されたdialogを開いた処理をしたはずなのにlist2のnestされたdialogを開いたりなどエラーが発生するので素直にオフィシャル通りに

<template v-slot:activator="{on, attrs}">で対応する

raspberry pi: HDD mount erro / device size is reported zero invalid partition

sudo mkfs ext4 -n /dev/sda 

>>>device size is reported zero invalid partition

物理的にHDDのコネクタが緩んで電源不足で上記エラーが出ることがある。

 

ref:

http://monteecristoo.hatenablog.com/entry/2018/04/20/115733

http://monteecristoo.hatenablog.com/entry/2020/07/29/123741

raspberry pi で起動したらCannnot open access to console, the root account is locked.

raspberry pi で起動したらCannnot open access to console, the root account is locked.

 

ディスクのマウント時にエラーが発生している可能性あり。

SDカードを外して別のPCで

boot/cmdline.txtの末尾に半角スペースinit=/bin/shを追記。

raspberry pi を起動

コマンドを受け付けるようになるので

sudo nano /etc/fstab

でマウントポイント/bootにマウントしているデバイスネームを調べる。

(/dev/mmcblk0p6だった)

sudo umont /

sudo mount -o remount,rw /dev/mmcblk0p6 /

上記操作でリマウントしないと編集したい/etc/fstabがリードオンリーになるため。

これで編集可能になったため/etc/fstabのマウントエラーを起こすディスクをコメントアウトする。

SDカードを取り出して別のPCから

boot/cmdline.txtの末尾の半角スペースinit=/bin/shを削除。

 

起動可能になった

 

ref: 

https://qiita.com/shohei_ot/items/515f5c2057481d315d71