アプリ関連ニュース

Using controller function directly in Laravel blade

Today I would like to talk about using the function from controller directly on your blade view files.

Normally we wrote codes relating with application logic and database and then pass the data to specific view files. But what if we like to use the function from controller directly ?

We can create a static function in controller and then can directly be called from blade file without instantiating the class. Let me write a sample example.

Firstly, we will create a static function in controller. Why static function ?

If we create a normal function, we will need to instantiate the class in view file like this `new Controller()` which will be a mess in view files. Static function can be directly called using scope resolution (::) operator.

<?php

namespace App\Http\Controllers;

class HomeController extends Controller
{
    public static function greet() 
    {
        return "Hello World";
    }
}

After that we can call the above controller function directly by providing the namespace of the controller and function using scope resolution operator like this.

<p>                                    
{{ App\Http\Controllers\HomeController::greet() }}
<!-- output - Hello World -->
</p>

By Yuuma



年末年始営業のご案内

拝啓 年の瀬も押し詰まり、ご多用のことと存じ上げます。
さて、誠に勝手ながら、弊社の年末年始の営業は、下記のとおりとさせていただきます。
皆様にはご迷惑をお掛けしますが、何卒ご容赦願います。
今年一年ご愛顧を賜りまして大変感謝申し上げますと伴に、皆様のご多幸をお祈りいたします 。

敬具

年内営業   令和2年12月28日 13:00まで
年始営業   令和3年1月4日 10:00より



Wappalyzer technology profiler

I introduced an extension called daily.dev to read the development related articles. I will introduce more browser extension that are extremely useful next time. Also today I would like to introduce an extension called wappalyzer

Wappalyzer is a technology profiler that shows you what websites are built with.

Further more, it discovers more than a thousand technologies in dozens of categories such as programming languages, analytics, marketing tools, payment processors, CRM, CDN and others.

Go ahead this link and install the extension.

Lets take a look at yahoo website, https://www.yahoo.co.jp/

We can see the technologies we are using through the wapplyzer extension like this.

Lets take a look at another site medium.com, and lets see what technologies they are using.

Conclusion, this is a very useful plugin to trace technologies in a website such an easy way.

By Yuuma.



[PHP] アップロード可能な最大ファイルサイズを調整する

データベースの復元処理など、ダンプファイルの容量がアップロード可能な最大ファイルサイズの初期設定(2MB)を超えている場合があります。

今回はそのような場合の対処方法を3パターン紹介します。

続きを読む

ポートフォワーディングを使ってAndroidでlocalhostページを表示する

開発中のページでWebRTCを使ってAndroidのカメラの映像を
Javascriptで取得できるか確認を行いたい時があります。

続きを読む

アプリ関連ニュース

お問い合わせはこちら

お問い合わせ・ご相談はお電話、またはお問い合わせフォームよりお受け付けいたしております。

tel. 06-6454-8833(平日 10:00~17:00)

お問い合わせフォーム