{"id":12709,"date":"2024-06-09T07:00:11","date_gmt":"2024-06-08T22:00:11","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=12709"},"modified":"2024-06-05T06:02:43","modified_gmt":"2024-06-04T21:02:43","slug":"laravel-ipinfo-%e3%81%a7%e3%82%a2%e3%82%af%e3%82%bb%e3%82%b9%e5%a0%b4%e6%89%80%e3%81%ae%e3%82%bb%e3%82%b0%e3%83%a1%e3%83%b3%e3%83%88%e3%82%92%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=12709","title":{"rendered":"\u3010Laravel\u3011\u7121\u6599\u3067\u3067\u304d\u308b\u4f4d\u7f6e\u60c5\u5831\u3092\u4f7f\u3063\u305f\u30bb\u30fc\u30eb\u30b9\u624b\u6cd5"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u300116\u672c\u306e\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u8b1b\u7fa9\u3092\u3059\u3067\u306b3\u5468\u3057\u3066\u307e\u3059\u304c\u3001\u91cf\u3092\u3053\u306a\u3059\u305f\u3081\u3044\u308d\u3044\u308d\u8abf\u3079\u305f\u3089\u300c\u3053\u308c\u306f\u81ea\u5206\u3082\u3084\u3089\u308c\u3066\u305f\u306a\ud83d\ude02\u300d\u3068\u3044\u3046\u624b\u6cd5\u3092\u898b\u3064\u3051\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u308c\u306f\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><strong style=\"font-size: 35px;\">\u4f4d\u7f6e\u60c5\u5831\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0<\/strong><\/p>\n<p>\u3067\u3059\u3002\u4f8b\u3048\u3070\u3001<\/p>\n<ul>\n<li>\u88d5\u798f\u306a\u30a8\u30ea\u30a2\u306b\u4f4f\u3093\u3067\u3044\u308c\u3070\u3001\u9ad8\u984d\u306a\u5546\u54c1\u3092\u8cb7\u3044\u3084\u3059\u3044<\/li>\n<li>\u5730\u65b9\u30a8\u30ea\u30a2\u306a\u3089\u79fb\u52d5\u624b\u6bb5\u3092\u8003\u3048\u3066\u30af\u30eb\u30de\u95a2\u9023\u306e\u5546\u54c1<\/li>\n<li>\u5bb6\u65cf\u304c\u591a\u3044\u30a8\u30ea\u30a2\u306a\u3089\u30ad\u30c3\u30ba\u5546\u54c1<\/li>\n<\/ul>\n<p>\u306a\u3069\u306a\u3069\u3001\u3044\u308d\u3093\u306a\u30d1\u30bf\u30fc\u30f3\u304c\u5b58\u5728\u3059\u308b\u308f\u3051\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u5b9f\u306fIP\u30a2\u30c9\u30ec\u30b9\u304c\u3042\u308c\u3070\uff08\u3060\u3044\u305f\u3044\uff09\u30a2\u30af\u30bb\u30b9\u4f4d\u7f6e\u304c\u5206\u304b\u308b\u30b5\u30fc\u30d3\u30b9\u304c\u3042\u3063\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u2757<br \/>\n\u4eca\u56de\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u4eba\u306e\u305f\u3081\u306b\u8a18\u4e8b\u3092\u304a\u5c4a\u3051\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li>Laravel\u3068\u4f4d\u7f6e\u60c5\u5831\u3092\u7d61\u3081\u305f\u6a5f\u80fd\u3092\u3064\u304f\u308a\u305f\u3044<\/li>\n<li>Laravel\u3067\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u306e\u6a5f\u80fd\u3092\u3064\u304f\u3063\u3066\u307f\u305f\u3044<\/li>\n<li>Laravel\u306e\u77e5\u8b58\u3092\u3068\u306b\u304b\u304f\u8caf\u3081\u3066\u304a\u304d\u305f\u3044<\/li>\n<\/ul>\n<p>\u305c\u3072\u6700\u5f8c\u307e\u3067\u8aad\u3093\u3067\u304f\u3060\u3055\u3044\ud83d\ude0a\u2728<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9809 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/11\/no_9.png\" alt=\"\" width=\"370\" height=\"220\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/11\/no_9.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/11\/no_9-300x178.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/>\u300c\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u3082\u9818\u57df\u304c\u5e83\u3044\u304b\u3089<br \/>\n\u5b66\u3076\u3053\u3068\u3044\u3063\u3071\u3044\uff01\u300d<\/p>\n<h1>\u524d\u63d0\u3068\u3057\u3066<\/h1>\n<p><code>Laravel<\/code>\u306b\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u524d\u63d0\u3067\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30da\u30fc\u30b8\u3092\u53c2\u8003\u306b\u3057\u3066\u5148\u306b\u7528\u610f\u3057\u3066\u304a\u3044\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<p><strong>\ud83d\udcdd \u53c2\u7167\u30da\u30fc\u30b8<\/strong>\uff1a\u00a0<a href=\"https:\/\/blog.capilano-fw.com\/?p=8301\">Laravel Breeze\u3067\u300c\u30b7\u30f3\u30d7\u30eb\u306a\u300d\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/p>\n<p><span style=\"font-size: 1.5rem;\">IPinfo\u306e\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97\u3059\u308b<\/span><\/p>\n<div>\n<p><a href=\"https:\/\/ipinfo.io\/\" target=\"_blank\" rel=\"noopener\"><strong>IPinfo<\/strong><\/a> \u306f<code>IP<\/code>\u30a2\u30c9\u30ec\u30b9\u304b\u3089\u305d\u306e\u5834\u6240\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u308b\u30b5\u30fc\u30d3\u30b9\u3067\u6708<code>50,000<\/code>\u56de\u307e\u3067\u7121\u6599\u3067\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\uff08<code>2024.5.9<\/code>\u73fe\u5728\uff09<\/p>\n<p>\u203b \u305f\u3060\u3057\u53d6\u5f97\u51fa\u6765\u308b\u60c5\u5831\u306f\u6700\u4f4e\u9650\u306e\u3082\u306e\u3060\u3051\u3067\u3059\u3002\u8a73\u3057\u304f\u306f<a href=\"https:\/\/ipinfo.io\/pricing\" target=\"_blank\" rel=\"noopener\">\u3053\u3061\u3089<\/a><\/p>\n<\/div>\n<p>\u3067\u306f\u3001\u307e\u305a\u306f <a href=\"https:\/\/ipinfo.io\/\" target=\"_blank\" rel=\"noopener\"><strong>IPinfo<\/strong><\/a> \u3078\u79fb\u52d5\u3057\u3001 \u53f3\u4e0a\u306e\u300c<strong>Sing up<\/strong>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12716\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_1.png\" alt=\"\" width=\"316\" height=\"142\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_1.png 316w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_1-300x135.png 300w\" sizes=\"auto, (max-width: 316px) 100vw, 316px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u30d5\u30a9\u30fc\u30e0\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3001\u540d\u524d\u3068\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3057\u3066\u9001\u4fe1\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12714\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_2.png\" alt=\"\" width=\"536\" height=\"609\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_2.png 536w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_2-264x300.png 264w\" sizes=\"auto, (max-width: 536px) 100vw, 536px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u8a8d\u8a3c\u30e1\u30fc\u30eb\u304c\u5c4a\u304f\u306e\u3067\u300c<strong>Verify email address<\/strong>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12713\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_3.png\" alt=\"\" width=\"309\" height=\"257\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_3.png 309w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_3-300x250.png 300w\" sizes=\"auto, (max-width: 309px) 100vw, 309px\" \/><\/p>\n<p>\u3053\u308c\u3067\u3001\u672c\u767b\u9332\u304c\u5b8c\u4e86\u3057\u81ea\u52d5\u30ed\u30b0\u30a4\u30f3\u3055\u308c\u307e\u3059\u3002<br \/>\n\u3059\u308b\u3068\u3001\u79fb\u52d5\u5f8c\u306e\u30da\u30fc\u30b8\u4e0b\u90e8\u306b\u30c8\u30fc\u30af\u30f3\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12712\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_4.png\" alt=\"\" width=\"640\" height=\"188\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_4.png 640w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_4-300x88.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>\u3053\u308c\u3092<code>Laravel<\/code>\u3067\u3044\u3064\u3067\u3082\u4f7f\u3048\u308b\u3088\u3046\u306b<code>.env<\/code>\u306b\u30bb\u30c3\u30c8\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><strong>.env<\/strong><\/p>\n<div>\n<pre><strong>IPINFO_TOKEN=\uff08\u3053\u3053\u306b\u30c8\u30fc\u30af\u30f3\uff09<\/strong><\/pre>\n<p>\u203b \u672c\u6765\u306f<code>config<\/code>\u306b\u5165\u308c\u3066\u304a\u304f\u3079\u304d\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u7701\u7565\u3057\u307e\u3059\u3002<\/p>\n<h1>DB\u5468\u308a\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u307e\u305a\u306f\u30e2\u30c7\u30eb\u3068\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u3064\u304f\u308a\u307e\u3057\u3087\u3046\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<div>\n<pre><strong>php artisan make:model UserLocation -m<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<\/div>\n<p><strong>app\/Models\/UserLocation.php<\/strong><\/p>\n<\/div>\n<div>\n<pre><strong>&lt;?php<\/strong>\r\n\r\n<strong>namespace App\\Models;<\/strong>\r\n\r\n<strong>use Illuminate\\Database\\Eloquent\\Factories\\HasFactory;<\/strong>\r\n<strong>use Illuminate\\Database\\Eloquent\\Model;<\/strong>\r\n\r\n<strong>class UserLocation extends Model<\/strong>\r\n<strong>{<\/strong>\r\n<strong>    use HasFactory;<\/strong>\r\n\r\n<strong>    protected $fillable = [<\/strong>\r\n<strong>        'user_id',<\/strong>\r\n<strong>        'city',<\/strong>\r\n<strong>        'region',<\/strong>\r\n<strong>        'country',<\/strong>\r\n<strong>    ];<\/strong>\r\n<strong>}<\/strong><\/pre>\n<\/div>\n<p><strong>database\/migrations\/****_**_**_******_create_user_locations_table.php<\/strong><\/p>\n<div>\n<pre>&lt;?php\r\n\r\nuse Illuminate\\Database\\Migrations\\Migration;\r\nuse Illuminate\\Database\\Schema\\Blueprint;\r\nuse Illuminate\\Support\\Facades\\Schema;\r\n\r\nreturn new class extends Migration\r\n{\r\n    \/**\r\n     * Run the migrations.\r\n     *\/\r\n    public function up(): void\r\n    {\r\n        <strong>Schema::create('user_locations', function (Blueprint $table) {<\/strong>\r\n<strong>            $table-&gt;id();<\/strong>\r\n<strong>            $table-&gt;unsignedBigInteger('user_id')-&gt;comment('\u30e6\u30fc\u30b6\u30fc ID');<\/strong>\r\n<strong>            $table-&gt;string('city')-&gt;comment('\u5e02\u533a\u753a\u6751');<\/strong>\r\n<strong>            $table-&gt;string('region')-&gt;comment('\u90fd\u9053\u5e9c\u770c');<\/strong>\r\n<strong>            $table-&gt;string('country')-&gt;comment('\u56fd');<\/strong>\r\n<strong>            $table-&gt;timestamps();<\/strong>\r\n\r\n<strong>            $table-&gt;foreign('user_id')-&gt;references('id')-&gt;on('users');<\/strong>\r\n<strong>        });<\/strong>\r\n    }\r\n\r\n    \/**\r\n     * Reverse the migrations.\r\n     *\/\r\n    public function down(): void\r\n    {\r\n        Schema::dropIfExists('user_locations');\r\n    }\r\n};<\/pre>\n<p>\u4eca\u56de\u306f\u300c<strong>\u5e02\u533a\u753a\u6751\u3001\u90fd\u9053\u5e9c\u770c\u3001\u56fd<\/strong>\u300d\u3067\u306e\u5224\u5225\u3067\u3059\u304c<code>IPinfo<\/code>\u3067\u306f\u7121\u6599\u7248\u3067\u3082\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u5e02\u533a\u753a\u6751\uff08\u90fd\u5e02\u540d\uff09<\/li>\n<li>\u90fd\u9053\u5e9c\u770c\uff08\u5730\u65b9\u540d\uff09<\/li>\n<li>\u56fd<\/li>\n<li>\u7def\u5ea6\u7d4c\u5ea6\uff08GPS\uff09<\/li>\n<li>\u7d44\u7e54\uff08\u30d7\u30ed\u30d0\u30a4\u30c0\u30fc\uff09<\/li>\n<li>\u90f5\u4fbf\u756a\u53f7<\/li>\n<li>\u30bf\u30a4\u30e0\u30be\u30fc\u30f3<\/li>\n<\/ul>\n<p>\u3067\u306f\u3001\u3053\u306e\u72b6\u614b\u3067\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<div>\n<pre><strong>php artisan migrate<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u5b9f\u969b\u306e\u30c6\u30fc\u30d6\u30eb\u306f\u3053\u3046\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12723\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_5.png\" alt=\"\" width=\"413\" height=\"305\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_5.png 413w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_5-300x222.png 300w\" sizes=\"auto, (max-width: 413px) 100vw, 413px\" \/><\/p>\n<\/div>\n<h1>\u30ed\u30b0\u30a4\u30f3\u3092\u30ad\u30e3\u30c3\u30c1\u3059\u308b\u30a4\u30d9\u30f3\u30c8\u30ea\u30b9\u30ca\u30fc\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u30ed\u30b0\u30a4\u30f3\u3057\u305f\u3068\u304d\u306b\u81ea\u52d5\u3067\u5b9f\u884c\u3055\u308c\u308b\u30b3\u30fc\u30c9\uff08\u30ea\u30b9\u30ca\u30fc\uff09\u3092\u3064\u304f\u3063\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><strong>app\/Providers\/AppServiceProvider.php<\/strong><\/p>\n<div>\n<pre><strong>&lt;?php<\/strong>\r\n\r\n<strong>namespace App\\Providers;<\/strong>\r\n\r\n<strong>use App\\Models\\UserLocation;<\/strong>\r\n<strong>use Illuminate\\Auth\\Events\\Login;<\/strong>\r\n<strong>use Illuminate\\Support\\Arr;<\/strong>\r\n<strong>use Illuminate\\Support\\Facades\\Http;<\/strong>\r\n<strong>use Illuminate\\Support\\ServiceProvider;<\/strong>\r\n<strong>use Illuminate\\Support\\Facades\\Event;<\/strong>\r\n\r\n<strong>class AppServiceProvider extends ServiceProvider<\/strong>\r\n<strong>{<\/strong>\r\n<strong>    \/**<\/strong>\r\n<strong>     * Register any application services.<\/strong>\r\n<strong>     *\/<\/strong>\r\n<strong>    public function register(): void<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        \/\/<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    \/**<\/strong>\r\n<strong>     * Bootstrap any application services.<\/strong>\r\n<strong>     *\/<\/strong>\r\n<strong>    public function boot(): void<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        Event::listen(<\/strong>\r\n<strong>            Login::class,<\/strong>\r\n<strong>            [$this, 'onLogin']<\/strong>\r\n<strong>        );<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function onLogin(Login $event): void<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $ip = request()-&gt;ip();<\/strong>\r\n<strong>        $token = env('IPINFO_TOKEN');<\/strong>\r\n<strong>        $url = 'https:\/\/ipinfo.io\/'. $ip .'?token='. $token;<\/strong>\r\n<strong>        $response = Http::get($url);<\/strong>\r\n\r\n<strong>        if($response-&gt;ok()) {<\/strong>\r\n\r\n<strong>            $user = $event-&gt;user;<\/strong>\r\n<strong>            $ip_data = $response-&gt;json();<\/strong>\r\n\r\n<strong>            if(Arr::has($ip_data, 'city')<\/strong>\r\n<strong>                &amp;&amp; Arr::has($ip_data, 'region')<\/strong>\r\n<strong>                &amp;&amp; Arr::has($ip_data, 'country')) {<\/strong>\r\n\r\n<strong>                UserLocation::firstOrCreate([<\/strong>\r\n<strong>                    'user_id' =&gt; $user-&gt;id,<\/strong>\r\n<strong>                    'city' =&gt; $ip_data['city'],<\/strong>\r\n<strong>                    'region' =&gt; $ip_data['region'],<\/strong>\r\n<strong>                    'country' =&gt; $ip_data['country'],<\/strong>\r\n<strong>                ]);<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n<strong>    }<\/strong>\r\n<strong>}<\/strong><\/pre>\n<p>\u203b \u306a\u304a\u3001<code>Illuminate\\Support\\Facades\\Http<\/code>\u3092\u4f7f\u3063\u3066\u304a\u304f\u3068\u3001\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u3068\u304d\u306b\u30d5\u30a7\u30a4\u30af\u306e\u30ec\u30b9\u30dd\u30f3\u30b9\u3068\u304b\u3092\u6307\u5b9a\u3067\u304d\u3066\u4fbf\u5229\u3067\u3059\u3088\u2757<\/p>\n<\/div>\n<\/div>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u4eca\u56de\u306f\u30c6\u30b9\u30c8\u7528\u306eIP\u30a2\u30c9\u30ec\u30b9<code>8.8.8.4<\/code>\u3092\u4f7f\u3044\u305f\u3044\u306e\u3067\u5c11\u3057\u3060\u3051\u30b3\u30fc\u30c9\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Providers\/AppServiceProvider.php<\/strong><\/p>\n<div>\n<pre>\/\/        $ip = request()-&gt;ip();\r\n        <strong>$ip = '8.8.8.4';<\/strong> \/\/ \ud83d\udc48 \u3053\u308c\u306b\u7f6e\u304d\u63db\u3048\u307e\u3057\u305f<\/pre>\n<\/div>\n<p>\u3067\u306f\u3001\u300c<strong>https:\/\/******\/login<\/strong>\u300d\u3078\u30d6\u30e9\u30a6\u30b6\u3067\u30a2\u30af\u30bb\u30b9\u3057\u3066\u30ed\u30b0\u30a4\u30f3\u3057\u307e\u3059\u3002<\/p>\n<p>\u3059\u308b\u3068\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12718\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_6.png\" alt=\"\" width=\"503\" height=\"204\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_6.png 503w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_6-300x122.png 300w\" sizes=\"auto, (max-width: 503px) 100vw, 503px\" \/><\/p>\n<p>\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u3001\u30c6\u30fc\u30d6\u30eb\u3092\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12719\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_7.png\" alt=\"\" width=\"445\" height=\"273\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_7.png 445w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_7-300x184.png 300w\" sizes=\"auto, (max-width: 445px) 100vw, 445px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\nIP\u30a2\u30c9\u30ec\u30b9\u304b\u3089\u5834\u6240\u306e\u60c5\u5831\u304c\u53d6\u5f97\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u308c\u306f\u3001<code>Google<\/code>\u306eIP\u30a2\u30c9\u30ec\u30b9\u3067\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u3001\u5e74\u306e\u305f\u3081\u3082\u3046\u3072\u3068\u3064<code>IPinfo<\/code>\u304c\u7528\u610f\u3057\u3066\u304f\u308c\u3066\u3044\u305f<code>1.1.1.14<\/code>\u3078\u5909\u66f4\u3057\u3066\u30ed\u30b0\u30a4\u30f3\u3057\u306a\u304a\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u3069\u3046\u306a\u308b\u3067\u3057\u3087\u3046\u304b\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12720\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_8.png\" alt=\"\" width=\"445\" height=\"297\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_8.png 445w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/06\/laravel_ip_segment_8-300x200.png 300w\" sizes=\"auto, (max-width: 445px) 100vw, 445px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u307e\u305f\u3072\u3068\u3064\u5897\u3048\u307e\u3057\u305f\u306d\u3002<\/p>\n<p>\u6210\u529f\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<h1>\u4f01\u696d\u69d8\u3078\u306e\u3054\u63d0\u6848<\/h1>\n<p>\u4eca\u56de\u306e\u3088\u3046\u306b\u3001\u30e6\u30fc\u30b6\u30fc\u306e\u4f4d\u7f6e\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u306e\u3067\u3001\u3082\u3057\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u69d8\u304c\u4f4d\u7f6e\u60c5\u5831\u306b\u95a2\u9023\u304c\u9ad8\u3044\u5546\u54c1\u3092\u304a\u6301\u3061\u3067\u3057\u305f\u3089\u3001\u304d\u3063\u3068\u304a\u529b\u306b\u306a\u308c\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3082\u3057\u305d\u3046\u3044\u3063\u305f\u3054\u76f8\u8ac7\u304c\u3054\u3056\u3044\u307e\u3057\u305f\u3089\u3001\u3044\u3064\u3067\u3082\u304a\u6c17\u8efd\u306b\u304a\u554f\u3044\u5408\u308f\u305b\u304b\u3089\u3054\u9023\u7d61\u4e0b\u3055\u3044\u3002<\/p>\n<p>\u304a\u5f85\u3061\u3057\u3066\u304a\u308a\u307e\u3059\u3002\ud83d\ude0a\u2728<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f\u4f4d\u7f6e\u60c5\u5831\u3092<code>IP<\/code>\u30a2\u30c9\u30ec\u30b9\u304b\u3089\u53d6\u5f97\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u30db\u30f3\u30c8\u306b\u30c7\u30fc\u30bf\u306f\u4f7f\u3044\u65b9\u6b21\u7b2c\u3067\u30b4\u30df\u306b\u3082\u304a\u5b9d\u306b\u3082\u306a\u308b\u308f\u3051\u3067\u3001\u3053\u3046\u3044\u3046\u30c7\u30fc\u30bf\u51e6\u7406\u3092\u8003\u3048\u308b\u4eba\u3082\u8ce2\u3044\u3093\u3060\u308d\u3046\u306a\u3068\u3044\u3046\u5370\u8c61\u3067\u3059\u3002<\/p>\n<p>\u7686\u3055\u3093\u3082\u81ea\u793e\u3084\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3055\u3093\u306e\u305f\u3081\u306b\u300c\u4f4d\u7f6e\u60c5\u5831\u300d\u3092\u4f7f\u3063\u305f\u63d0\u6848\u3092\u3057\u3066\u307f\u3066\u306f\u3044\u304b\u304c\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\u2757<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6071 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_8.png\" alt=\"\" width=\"216\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_8.png 216w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_8-203x300.png 203w\" sizes=\"auto, (max-width: 216px) 100vw, 216px\" \/>\u300c\u6b21\u306f\u30e9\u30a4\u30c6\u30a3\u30f3\u30b0\u52c9\u5f37\u3059\u3063\u304b\u2757\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u300116\u672c\u306e\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u8b1b\u7fa9\u3092\u3059\u3067\u306b3\u5468\u3057\u3066\u307e\u3059\u304c\u3001\u91cf\u3092\u3053\u306a\u3059\u305f\u3081\u3044\u308d\u3044\u308d\u8abf\u3079\u305f\u3089\u300c\u3053\u308c\u306f\u81ea\u5206\u3082\u3084\u3089\u308c\u3066\u305f\u306a\ud83d\ude02\u300d\u3068\u3044\u3046\u624b\u6cd5\u3092\u898b\u3064\u3051\u307e\u3057\u305f\u3002 \u305d\u308c\u306f\u30fb\u30fb\u30fb &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=12709\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u3010Laravel\u3011\u7121\u6599\u3067\u3067\u304d\u308b\u4f4d\u7f6e\u60c5\u5831\u3092\u4f7f\u3063\u305f\u30bb\u30fc\u30eb\u30b9\u624b\u6cd5&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":12848,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,258],"tags":[],"class_list":["post-12709","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","category-258"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/12709","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12709"}],"version-history":[{"count":12,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/12709\/revisions"}],"predecessor-version":[{"id":12849,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/12709\/revisions\/12849"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/12848"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12709"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12709"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12709"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}