Skip to content

Instantly share code, notes, and snippets.

View yasaryousuf's full-sized avatar

Yasar Yousuf yasaryousuf

  • Dhaka, Bangladesh.
View GitHub Profile
@yasaryousuf
yasaryousuf / laravel-form.blade.php
Last active March 28, 2018 06:43
[laravel-form]
<form method="POST" action="/registation" id="reg-form">
{{ csrf_field() }}
<div class="modal-form-padding">
<div class="row">
<div class="col-md-6">
<div class="form-group {{ $errors->has('first_name') ? 'has-error' :'' }}">
<input type="text" class="modal-input-control" placeholder="First Name" name="first_name" id="first_name" value="{{ old('first_name') }}" required>
@if ($errors->has('first_name'))
<span class="help-block text-danger">
<strong>{{ $errors->first('first_name') }}</strong>
@yasaryousuf
yasaryousuf / laravel-logout.blade.php
Last active March 10, 2018 10:33
[laravel-logout]
<li>
<a href="{{ route('logout') }}"
onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
<i class="fa fa-sign-out"></i>Logout
</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
{{ csrf_field() }}
</form>
</li>
@yasaryousuf
yasaryousuf / laravel-image-validation.php
Created March 12, 2018 09:07
laravel-image-validation
$user->image_url = "profile.jpg";
if ($request->hasFile('user_image_url')) {
$image = $request->file('user_image_url');
$image_url = time().$image->getClientOriginalName();
$destinationPath = public_path('/profile-images');
$image->move($destinationPath, $image_url);
$user->image_url = $image_url;
}
@yasaryousuf
yasaryousuf / laravel-validation.php
Created March 12, 2018 09:08
laravel-validation
public function userValidation($request)
{
$request->validate([
'first_name' => 'required|max:25',
'last_name' => 'required|max:25',
'email' => 'required|max:50',
'user_image_url' => 'image|mimes:jpeg,png,jpg,gif,svg|max:1000'
]);
}
@yasaryousuf
yasaryousuf / sweet-alert-delete-confirmation.js
Created March 13, 2018 05:36
sweet-alert-delete-confirmation
$('.tutorial').on('click', function(){
var href = $(this).attr('href');
swal({
title: "Are you sure?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete it!",
cancelButtonText: "No, cancel plx!",
@yasaryousuf
yasaryousuf / wpdb-create-table.php
Last active April 9, 2018 05:23
[WPDB CREATE TABLE]
//
// Write below codes in class file
// _______________________________
<?php
/**
* Here should be all table and column which will create table
*/
class InstallTable
{
public static function event()
@yasaryousuf
yasaryousuf / WPDB-SHORT-CODES.php
Last active March 28, 2018 06:41
[WPDB SHORT CODES]
<?php
/**
*
*/
class ShortCode
{
public static function init()
{
@yasaryousuf
yasaryousuf / WP-FORM.php
Last active March 13, 2019 04:38
[WP FORM]
<?php
$OpsState = new OpsState;
$results = $OpsState->index();
?>
<div class="bootstrap-wrapper">
<form class="" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" method="POST">
<input type="hidden" name="action" value="update_states_link">
<?php wp_nonce_field('updateStatesLink-nonce', 'updateStatesLink');?>
<div class="row">
https://winnipeg.canadianskal.club/wp-admin/admin-post.php?action=test
@yasaryousuf
yasaryousuf / WP-AJAX.php
Last active March 28, 2018 06:40
[WP AJAX]
<script>
jQuery(function($){
$('#eventStatus').on('change', function (e) {
var status = this.value;
e.preventDefault();
$('#eventStatus').fadeOut(300);
console.log("testing");