Skip to content

Instantly share code, notes, and snippets.

View Miri92's full-sized avatar

Miri Zulfugar Miri92

View GitHub Profile
@Miri92
Miri92 / Payment.php
Created August 9, 2020 07:56
KapitalBank Payment API with PHP Laravel framework - Example snippet
<?php
namespace App\Models;
use App\Database\EloquentModel as Model;
class Payment extends Model
{
protected $fillable = ['order_id', 'session_id', 'currency', 'order_status', 'order_description', 'amount', 'payment_url', 'status_code','order_check_status','language_code'];
@Miri92
Miri92 / GalleryTrait.php
Created February 5, 2019 15:31
Laravel gallery trait
<?php
namespace App\Traits;
use App\Models\Elan;
use App\Models\ElanField;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Response;
@Miri92
Miri92 / functions.php
Created December 30, 2018 14:20
Wordpress - Custom meta box with checkbox field
function slider_get_meta( $value ) {
global $post;
$field = get_post_meta( $post->ID, $value, true );
if ( ! empty( $field ) ) {
return is_array( $field ) ? stripslashes_deep( $field ) : stripslashes( wp_kses_decode_entities( $field ) );
} else {
return false;
}
}
@Miri92
Miri92 / RegionsSeeder.php
Created November 17, 2018 12:11
Regions of Azerbaijan - Laravel seeder class
<?php
use App\Models\Region;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class RegionsSeeder extends Seeder
{
/**
* Run the database seeds.
@Miri92
Miri92 / MenuController.php
Created June 22, 2018 09:35
merge all sub level arrays into one level
<?php
class MenuController extends Controller
{
public function parseJsonArray($jsonArray, $parentID = 0) {
$return = array();
foreach ($jsonArray as $subArray) {
$returnSubSubArray = array();
if (isset($subArray->children)) {
$returnSubSubArray = $this->parseJsonArray($subArray->children, $subArray->id);
@Miri92
Miri92 / jquery_validation.html
Last active May 1, 2018 03:36
jQuery Validation example - Add rules to spesific class
<script type="text/javascript">
$( document ).ready(function() {
$( "#elan_form" ).validate({
//errorClass: '',
errorElement: "div",
errorPlacement: function ( error, element ) {
// Add the `help-block` class to the error element
error.addClass( "invalid-feedback" );
if ( element.prop( "type" ) === "checkbox" ) {
@Miri92
Miri92 / functions.php
Last active April 10, 2024 17:03
Wordpress walker class for wp_nav_menu() - change item and submenu class also add caret icon inside has-childiren item.
<?php
class My_Walker_Nav_Menu extends Walker_Nav_Menu {
function start_lvl(&$output, $depth = 0, $args = array()) {
$indent = str_repeat("\t", $depth);
$output .= "\n$indent<ul class=\"dropdown-menu\">\n";
}
@Miri92
Miri92 / weather
Created March 9, 2014 19:48
baku weather yandex xml api
<?php
$city_id=37864; // id şəhər
$data_file="http://export.yandex.ru/weather-ng/forecasts/$city_id.xml"; // xml fayl ünvanı
$xml = simplexml_load_file($data_file);
// lazım olan parametrləri seçirik (Şəhər, tempratur)
$temp=$xml->fact->temperature;
@Miri92
Miri92 / index.html
Last active December 24, 2015 23:09
DLE-də menu üzərinə active class əlavə etmək
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>DLE-də menu üzərinə active class əlavə etmək</title>
<script type="text/javascript">
$(function () {
$('.navigation a').each(function () {
var location = window.location.href
var link = this.href
@Miri92
Miri92 / 4-box.html
Last active December 24, 2015 16:49
4 box hazirlamaq (numune)
<!DOCTYPE html>
<html>
<head>
<style>
#dord-box {
width:650px;
float:left;
}
#dord-box div {