- 2025/10/31
- Category :
[PR]
×
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

ステップアップしていくブログです。
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
$_SERVER['REMOTE_ADDR']
$_SERVER['HTTP_X_FORWARDED_FOR']
str_limit($value, $limit = 100, $end = '…')指定した文字数以上だと三点リーダなどの文字を追加して返してくれます。
$string = str_random(40);ランダム文字列を返します。
dd($value);ダンプして実行を止めます。
$value = with(new Foo)->doWork();オブジェクトを返してくれます。メソッドチェーンしたいときに便利です。
$ git reset HEAD^
$ git reset HEAD ファイル名
$row = User::find(1);
class UserController extends BaseController {
    public function __construct(User $user)
    {
        parent::__construct();
        $this->model = $user;
    }
class UserController extends BaseController {
    public function hoge(User $user)
    {
        $user->foo()
    }
// Controller
$row = User::find(1);
// View
{{{$row->birthday->format('Y年m月d日')}}}
/**
 * Get the attributes that should be converted to dates.
 *
 * @return array
 */
public function getDates()
{
    $defaults = array(static::CREATED_AT, static::UPDATED_AT);
    return array_merge($this->dates, $defaults);
}
class User extends Eloquent {
    protected $dates = ['birthday'];
...
}
{{{$row->birthday->format('Y年m月d日')}}}