Skip to content

Instantly share code, notes, and snippets.

View saeedvir's full-sized avatar
🎯
Focusing

saeed abdollahian saeedvir

🎯
Focusing
View GitHub Profile
@saeedvir
saeedvir / OpenWithSublimeText.bat
Created January 15, 2020 07:28 — forked from zouyang08/OpenWithSublimeText.bat
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 10)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Directory\shell\Open with Sublime Text" /t REG_SZ /v "" /d "Open with Sublime Text" /f
@reg add "HKEY_CLASSES_ROOT\Directory\shell\Open with Sublime Text" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\Directory\shell\Open with Sublime Text\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
pause
@saeedvir
saeedvir / DataStructureGenerator.php
Last active July 20, 2020 09:01
Generate data in key/value structure / For ex: for admin panel dashboard
<?php
/**
*
* @author Saeedvir [
* 'email' => 'saeed.es91@gmail.com',
* 'telegram' => 'https://t.me/PhpWebDeveloper'
* ]
* @usage :
$dataGenerator = new DataStructureGenerator('data', true,true);
$dataGenerator->setData('users', 8);
@saeedvir
saeedvir / ApiDataResponse.php
Last active July 17, 2020 20:56
Standard API Response in PHP
<?php
/**
* Standard API Response in PHP
*
* https://github.com/obiefy/api-response
*
* @author Saeedvir [
* 'email' => 'saeed.es91@gmail.com',
* 'telegram' => 'https://t.me/PhpWebDeveloper'
* ]
@saeedvir
saeedvir / ModelForMedialibrary
Last active January 30, 2020 04:41
how to use "spatie/laravel-medialibrary" in shared host (solved)
by: https://github.com/saeedvir
telegram : https://t.me/PhpWebDeveloper
==============================================
package :
https://github.com/spatie/laravel-medialibrary
("proc_open" function is disabled in shared host)
use this code in your model :
@saeedvir
saeedvir / create png from text in php
Created February 19, 2020 14:46
create png from text in php
<?php
$to_store ='test-file.png';
$img_data=null;
$fontSize = 20;
$imgWidth = 400;
$imgHeight = 80;
$angle = 0;
$font = 'font_name.ttf';
@saeedvir
saeedvir / cloudSettings
Last active August 4, 2020 03:53
my Vscode Settings
{"lastUpload":"2020-08-04T03:52:57.654Z","extensionVersion":"v3.4.3"}
@saeedvir
saeedvir / Laravel Data Masking (Encode & Decode Model fields ) Trait
Last active October 19, 2022 07:35
Laravel Data Masking (Encode & Decode Model fields ) Trait
/*
** saeed abdollahian
** Freelance PHP developer & consultant. Laravel specialist.
** Freelance (available)
** https://t.me/PhpWebDeveloper
*/
<?php
namespace App;
/*
@saeedvir
saeedvir / Debug.php
Created November 21, 2022 05:03 — forked from sunel/Debug.php
PHP Pretty var_dump
<?php
class Debug {
/**
* A collapse icon, using in the dump_var function to allow collapsing
* an array or object
*
* @var string
*/
@saeedvir
saeedvir / TinyMCE Upload image and laravel
Last active December 1, 2023 02:30
TinyMCE Upload image + laravel
/*
* Laravel Route Or Controller
*/
Route::post('tinymce-upload', function (Request $request) {
#Check For Upload (add your security !!!)
$fileName = request()->file('file')->getClientOriginalName();
$path = request()->file('file')->storeAs('uploads', $fileName, 'public');
return response()->json(['location' => "/storage/$path"]);
@saeedvir
saeedvir / Laravel_UpdateOrCreateOrIncrement
Last active January 5, 2024 03:52
Laravel UpdateOrCreateOrIncrement
<?php
YourModel::updateOrCreate(
[
'user_id' => '1',
'user_type' => 'admin'
],
[
'user_id' => '1',
'user_type' => 'admin',
'value' => DB::raw('value + 1'),