Skip to content

Instantly share code, notes, and snippets.

View tarekmonjur's full-sized avatar

Tarek Monjur tarekmonjur

View GitHub Profile
<?php
namespace App\Exceptions;
use Exception;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
In Blade.php
{!! Form::open(['url' => 'product', 'method' => 'POST', 'class'=>'dropzone','id'=>'dropzone_file_upload']) !!}
<!-- text input -->
<div class="form-group">
<label>Product Title</label>
<input type="text" required name="title" class="form-control" placeholder="Enter ...">
</div>
<!-- textarea -->
public function fileView($id){
$photo_object =Notice::findOrFail($id);
$headers = array('Content-Type' => 'pdf');
$response = \Response::download(public_path('notice_uploads/'.$photo_object->file), $photo_object->file, $headers);
ob_end_clean();
return $response;
}
@tarekmonjur
tarekmonjur / goto-sublime
Created December 17, 2015 10:42 — forked from kendellfab/goto-sublime
Add mouse click `goto definition` in sublime text 3.
Linux - create "Default (Linux).sublime-mousemap" in ~/.config/sublime-text-3/Packages/User
Mac - create "Default (OSX).sublime-mousemap" in ~/Library/Application Support/Sublime Text 3/Packages/User
Win - create "Default (Windows).sublime-mousemap" in %appdata%\Sublime Text 3\Packages\User
[
{
"button": "button1",
"count": 1,
"modifiers": ["ctrl"],
"press_command": "drag_select",
if ($request->file('csv')->isValid()){
$csv = $request->file('csv');
$list_id = DB::table('list')->insertGetId(['list_name'=>$request->get('name'),'list_about'=>$request->get('about')]);
if($list_id){
$csvContent = [];
$file = fopen($csv->getRealPath(),"r");
while(!feof($file))
{
@tarekmonjur
tarekmonjur / upload csv
Created May 22, 2016 18:24
import from csv file
$csvContent = [];
$file = fopen($csv->getRealPath(),"r");
while(!feof($file))
{
// print_r(fgetcsv($file));
$content = fgetcsv($file);
$csvContent[] = [
'list_fullname' => $content[0],
'list_email' => $content[1]
Route::get('/csv', function() {
$table = ApplyOnline::all();
$output = "Company Name,Company Address,Product Lineup,Name of Company Owner,Address of Company Owner,NID of Authorized Person,Company Trade License No,Company TIN No,Contact No,Repersentative,Email,Website\n";
$count= 0;
foreach ($table as $data) {
$output.= $data->companyname.",";
$output.= $data->companyaddress.",";
$output.= $data->lineup.",";
$output.= $data->companyowner.",";
<?php
if (!isset($_SESSION))
session_start(); // start Session, if not already started
$filetxt = 'userson.txt'; // the file in which the online users /visitors are stored
$timeon = 120; // number of secconds to keep a user online
$sep = '^^'; // characters used to separate the user name and date-time
$vst_id = '-vst-'; // an identifier to know that it is a visitor, not logged user
// get the user name if it is logged, or the visitors IP (and add the identifier)
$uvon = isset($_SESSION['uid']) ? $_SESSION['uid'] : $_SERVER['SERVER_ADDR'] . $vst_id;
@tarekmonjur
tarekmonjur / counter.php
Last active May 28, 2017 06:30
Online user count and time duration
<?php
if (!isset($_SESSION))
session_start(); // start Session, if not already started
$filetxt = APPPATH .'views/online_users/userson.txt'; // the file in which the online users /visitors are stored
$timeon = 120; // number of secconds to keep a user online
$sep = '^^'; // characters used to separate the user name and date-time
$vst_id = '-vst-'; // an identifier to know that it is a visitor, not logged user
$todate = date('Y-m-d');
@extends('layouts.app')
@section('content')
<div class="container" id='todo2'>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<alert-success :alertmessage="alertMsg" v-if="success"></alert-success>
<alert-danger :alertmessage="alertMsg" v-if="danger"></alert-danger>