Skip to content

Instantly share code, notes, and snippets.

View vickymessii's full-sized avatar
🎯
Focusing

Vikram Masih vickymessii

🎯
Focusing
View GitHub Profile
@vickymessii
vickymessii / .htaccess
Last active November 3, 2021 14:33
React Routing Refresh page issue fix
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>
@vickymessii
vickymessii / .htaccess
Created July 21, 2021 18:55
Enable Gzip compression in Laravel assets #laravel #php
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
Route:
Route::get('message/{id}','AuthorController@getMessage');
Controller:
public function getMessage($id)
{
$message = DB::table('messages')->where('id',$id)->first();
return view('ajax-message',['message'=>$message]);
@vickymessii
vickymessii / Laravel-Container.md
Created February 26, 2021 07:04
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).