Skip to content

Instantly share code, notes, and snippets.

View mehedithedue's full-sized avatar

Mehedi Hassan mehedithedue

View GitHub Profile
/*
"react-dnd": "^5.0.0",
"react-dnd-html5-backend": "^3.0.2",
"react-beautiful-dnd": "^13.0.0",
*/
import { DragDropContext, Draggable, Droppable } from "react-beautiful-dnd";
function PopularTags({
tags,
existingPopularTag,
@mehedithedue
mehedithedue / Download all mp4 file from url
Created November 14, 2019 10:09
Download all mp4 file from a url and save in destination folder by Python
from bs4 import BeautifulSoup
import wget
import requests
import os
url = 'http://canvas.projekti.info/laracast/%20Intermediate%20Laravel/'
ext = 'mp4'
destinationFolder = "/home/mehedi/Downloads/intermediate_laravel/"
@mehedithedue
mehedithedue / Datatable Reload on Select Option JS
Created April 7, 2019 06:01
Datatable Reload on Select Option or other and Server side code with Laravel Yajra
function getDatatable(parameter = null) {
var token = $('input[name="_token"]').val();
$('#datatable').DataTable({
iDisplayLength: 25,
processing: true,
serverSide: true,
searching: true,
ajax: {
@mehedithedue
mehedithedue / Where (OR AND) by Closure Laravel
Last active April 7, 2019 05:28
Where (OR AND) by Closure Laravel Eloquent ORM
$variable = Modal::where(function ($query) use ($info) {
$query->where('column_one', $info)
->orWhere('column_two', $info)
->orWhere('status', 3);
})
->where('deleted', 0)
->first();
@mehedithedue
mehedithedue / Logical Condition in Where Laravel
Last active April 7, 2019 05:29
Logical conditional query in where clause in Laravel ORM
Model::leftJoin('dummy_table', 'dummy_table.id', '=', 'mock_table.foreign_key')
->where('dummy_table.status', 1)
->where(function ($query) {
$users = Auth::user()->id;
if ($users == '12') {
$query->where('dummy_table.created_by', '=', Auth::user()->id)
->where('dummy_table.user_group', 'user');
} else if (in_array($users, [1, 4, 6])) {
$query->whereIn('dummy_table.created_by', [1, 4, 6]);
} else {
mysql> select * from product_category;
+-----------+----------------+---------------------+
| id | category_id | product_id |
+-----------+----------------+---------------------+
| 1 | 1 | 2 |
| 2 | 2 | 2 |
| 3 | 3 | 2 |
| 4 | 2 | 3 |
| 5 | 2 | 4 |
| 6 | 3 | 4