Topic: Jobs

javascript GET Load data from json file 0

javascript GET Load data from json file

Today, We want to share with you javascript GET Load data from json file.
In this post we will show you how to get data from json file using javascript Example, hear for Loading external files: AJAX, XML, JSON we will give you demo and example for implement.
In this post, we will learn about Load JSON file locally using pure Javascript with an example.

A common use of JSON data is to read data all the jquery from a web server to call, and display allt the data jquery the data in a web page.This all the json chapter will teach you and display json, in 4 easy steps to learn, how to read and get JSON data, using function files.how to get data from json file using javascript Example

data.json

[{"Segment":"A","x":"Portfolio 1","y":"KPI 3","val":"-1000"},{"Segment":"A","x":"Portfolio 1","y":"KPI 4","val":"1500"},{"Segment":"A","x":"Portfolio 1","y":"KPI 5","val":"500"},{"Segment":"A","x":"Portfolio 1","y":"KPI 6","val":"800"},{"Segment":"B","x":"Portfolio 2","y":"KPI 1","val":"-900"},{"Segment":"B","x":"Portfolio 2","y":"KPI 2","val":"-1500"},{"Segment":"B","x":"Portfolio 2","y":"KPI 3","val":"-1600"},{"Segment":"B","x":"Portfolio 2","y":"KPI 4","val":"1700"},{"Segment":"B","x":"Portfolio 2","y":"KPI 5","val":"800"},{"Segment":"B","x":"Portfolio 2","y":"KPI 6","val":"900"},{"Segment":"C","x":"Portfolio 3","y":"KPI 1","val":"-1000"},{"Segment":"C","x":"Portfolio 3","y":"KPI 2","val":"-1100"},{"Segment":"C","x":"Portfolio 3","y":"KPI 3","val":"-1200"},{"Segment":"C","x":"Portfolio 3","y":"KPI 4","val":"800"},{"Segment":"C","x":"Portfolio 3","y":"KPI 5","val":"900"},{"Segment":"C","x":"Portfolio 3","y":"KPI 6","val":"1000"},{"Segment":"C","x":"Portfolio 4","y":"KPI 1","val":"1100"},{"Segment":"C","x":"Portfolio 4","y":"KPI 2","val":"1200"},{"Segment":"C","x":"Portfolio 4","y":"KPI 3","val":"1300"},{"Segment":"C","x":"Portfolio 4","y":"KPI 4","val":"1410"},{"Segment":"C","x":"Portfolio 4","y":"KPI 5","val":"1580"},{"Segment":"C","x":"Portfolio 4","y":"KPI 6","val":"-1806"},{"Segment":"D","x":"Portfolio 5","y":"KPI 1","val":"-1600"},{"Segment":"D","x":"Portfolio 5","y":"KPI 2","val":"-1700"},{"Segment":"D","x":"Portfolio 5","y":"KPI 3","val":"-200"},{"Segment":"D","x":"Portfolio 5","y":"KPI 4","val":"2200"},{"Segment":"D","x":"Portfolio 5","y":"KPI 5","val":"2300"},{"Segment":"D","x":"Portfolio 5","y":"KPI 6","val":"2400"},{"Segment":"D","x":"Portfolio 6","y":"KPI 1","val":"2500"},{"Segment":"D","x":"Portfolio 6","y":"KPI 2","val":"2600"},{"Segment":"D","x":"Portfolio 6","y":"KPI 3","val":"2700"},{"Segment":"D","x":"Portfolio 6","y":"KPI 4","val":"2800"},{"Segment":"D","x":"Portfolio 6","y":"KPI 5","val":"-2000"},{"Segment":"D","x":"Portfolio 6","y":"KPI 6","val":"-1900"},{"Segment":"D","x":"Portfolio 7","y":"KPI 1","val":"-1806"},{"Segment":"D","x":"Portfolio 7","y":"KPI 2","val":"-1806"},{"Segment":"D","x":"Portfolio 7","y":"KPI 3","val":"-1806"},{"Segment":"D","x":"Portfolio 7","y":"KPI 4","val":"-1806"},{"Segment":"D","x":"Portfolio 7","y":"KPI 5","val":"-1806"},{"Segment":"D","x":"Portfolio 7","y":"KPI 6","val":"-1806"},{"Segment":"A","x":"Portfolio 8","y":"KPI 1","val":"-1806"},{"Segment":"A","x":"Portfolio 8","y":"KPI 2","val":"-1806"},{"Segment":"A","x":"Portfolio 8","y":"KPI 3","val":"-1806"},{"Segment":"A","x":"Portfolio 8","y":"KPI 4","val":"-1806"},{"Segment":"A","x":"Portfolio 8","y":"KPI 5","val":"-1806"},{"Segment":"A","x":"Portfolio 8","y":"KPI 6","val":"-1806"},{"Segment":"D","x":"Portfolio 9","y":"KPI 1","val":"-1806"},{"Segment":"D","x":"Portfolio 9","y":"KPI 2","val":"-1806"},{"Segment":"D","x":"Portfolio 9","y":"KPI 3","val":"-1806"},{"Segment":"D","x":"Portfolio 9","y":"KPI 4","val":"-1806"},{"Segment":"D","x":"Portfolio 9","y":"KPI 5","val":"-1806"},{"Segment":"D","x":"Portfolio 9","y":"KPI 6","val":"-1806"},{"Segment":"A","x":"Portfolio 10","y":"KPI 1","val":"-1806"},{"Segment":"A","x":"Portfolio 10","y":"KPI 2","val":"-1806"},{"Segment":"A","x":"Portfolio 10","y":"KPI 3","val":"-1806"},{"Segment":"A","x":"Portfolio 10","y":"KPI 4","val":"-1806"},{"Segment":"A","x":"Portfolio 10","y":"KPI 5","val":"-1806"},{"Segment":"A","x":"Portfolio 10","y":"KPI 6","val":"-1806"},{"Segment":"A","x":"Portfolio 11","y":"KPI 1","val":"-1806"},{"Segment":"A","x":"Portfolio 11","y":"KPI 2","val":"-1806"},{"Segment":"A","x":"Portfolio 11","y":"KPI 3","val":"-1806"},{"Segment":"A","x":"Portfolio 11","y":"KPI 4","val":"-1806"},{"Segment":"A","x":"Portfolio 11","y":"KPI 5","val":"-1806"},{"Segment":"A","x":"Portfolio 11","y":"KPI 6","val":"-1806"},{"Segment":"B","x":"Portfolio 12","y":"KPI 1","val":"-1806"},{"Segment":"B","x":"Portfolio 12","y":"KPI 2","val":"-1806"},{"Segment":"A","x":"Portfolio 1","y":"KPI 1","val":"2100"},{"Segment":"A","x":"Portfolio 1","y":"KPI 2","val":"1500"},{"Segment":"B","x":"Portfolio 12","y":"KPI 3","val":"-1806"},{"Segment":"B","x":"Portfolio 12","y":"KPI 4","val":"-1806"},{"Segment":"B","x":"Portfolio 12","y":"KPI 5","val":"-1806"},{"Segment":"B","x":"Portfolio 12","y":"KPI 6","val":"-1806"},{"Segment":"C","x":"Portfolio 13","y":"KPI 1","val":"-1806"},{"Segment":"C","x":"Portfolio 13","y":"KPI 2","val":"-1806"},{"Segment":"C","x":"Portfolio 13","y":"KPI 3","val":"-1806"},{"Segment":"C","x":"Portfolio 13","y":"KPI 4","val":"-1806"},{"Segment":"C","x":"Portfolio 13","y":"KPI 5","val":"-1806"},{"Segment":"C","x":"Portfolio 13","y":"KPI 6","val":"-1806"},{"Segment":"C","x":"Portfolio 14","y":"KPI 1","val":"-1806"},{"Segment":"C","x":"Portfolio 14","y":"KPI 2","val":"-457"},{"Segment":"C","x":"Portfolio 14","y":"KPI 3","val":"-1806"},{"Segment":"C","x":"Portfolio 14","y":"KPI 4","val":"-1806"},{"Segment":"C","x":"Portfolio 14","y":"KPI 5","val":"-1806"},{"Segment":"C","x":"Portfolio 14","y":"KPI 6","val":"-1806"},{"Segment":"B","x":"Portfolio 15","y":"KPI 1","val":"-1806"},{"Segment":"B","x":"Portfolio 15","y":"KPI 2","val":"-1806"},{"Segment":"B","x":"Portfolio 15","y":"KPI 3","val":"-1806"},{"Segment":"B","x":"Portfolio 15","y":"KPI 4","val":"-1806"},{"Segment":"B","x":"Portfolio 15","y":"KPI 5","val":"-1806"},{"Segment":"B","x":"Portfolio 15","y":"KPI 6","val":"-547"}]

Example 1 : How to get from json file using javascript

index.html


<title>load external json file in javascript</title>
  


	Load JSON file locally using pure Javascript
	<div id="demo"></div>

<hr />
	<h1>Solution of AngularJs All Problems For Pakainfo.com</h1>
	<h3>
	<a href="https://pakainfo.com/">My First Web-Application in angularjs, So I am very happy and 1000+  more then people are used of Pakainfo.com </a>
</h3>



$.getJSON( "data.json", function( json ) {
	document.getElementById("demo").innerHTML=JSON.stringify(json);
 });


Example 2 : javascript read json file from url


<title>load external json file in javascript</title>
  


	Load JSON file locally using pure Javascript
	<table id="demo" border="1"></table>

<hr />
	<h1>Solution of AngularJs All Problems For Pakainfo.com</h1>
	<h3>
	<a href="https://pakainfo.com/">My First Web-Application in angularjs, So I am very happy and 1000+  more then people are used of Pakainfo.com </a>
</h3>



var obj_data = new Object();
$.getJSON( "data.json", function( json ) {
	obj_data=json;
	for(var i=0;i < obj_data.length;i++)
	{
			document.getElementById("demo").innerHTML += "<tr><td>Segment="+obj_data[i].Segment + " </td><td>X="+obj_data[i].x+ "</td><td>Y="+obj_data[i].y+ "</td><td>Value="+obj_data[i].val+"<td></tr>";
	}
 });


We hope you get an idea about javascript GET Load data from json file
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.

How to Open URL in New Tab using Vue JS 0

How to Open URL in New Tab using Vue JS

Today, We want to share with you How to Open URL in New Tab using Vue JS.
In this post we will show you Open a URL in a new tab using Vue JS, hear for open a new tab in browser using vuejs we will give you demo and example for implement.
In this post, we will learn about How to open some page on other tab in Vuejs with an example.

PHP

How to Open URL in New Tab using PHP

Vue.js Open link in new tab

You can use simple native Pure JavaScript function with some attributes window.open property to open a new tabs window link(url) in make new tab. Here in this Post, I Am Gonna to Step By step how you can use Vue.js Open link in new tab JavaScript Example property to open a link in vuejs new tab.

<div id="pakainfoapp">
	<button>Click Me - pakainfo</button>
</div>

 new Vue({
el: '#pakainfoapp',
  
  data: {
	  myModel:false
  },  
   methods:{
    myFunction: function () {		
		window.open("https://www.pakainfo.com", "_blank");		
    }
	}

});
 

Can vue-router open a link in a new tab?

let routeData = this.$router.resolve({name: 'about_us', query: {data: "pakainfo"}});
window.open(routeData.href, '_blank');

Laravel

How to Open URL in New Tab using Laravel

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Open a link in a new window using vuejs.
I would like to have feedback on my Pakainfo.com blog.Your valuable feedback, question, or comments about this article are always welcome.If you enjoyed and liked this post, don’t forget to share.

Role based access control using Laravel 5.7 Example 0

Role based access control using Laravel 5.7 Example

Today, We want to share with you Role based access control using Laravel 5.7 Example.In this post we will show you User Role based Authentication and Access Control in Laravel, hear for Laravel 5.7 User Roles and Permissions (ACL) using Spatie Tutorial we will give you demo and example for implement.In this post, we will learn about Laravel 5.7 Role Based Access Control using Middlewares with an example.

Role based access control using Laravel 5.7 Example

There are the Following The simple About Role based access control using Laravel 5.7 Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop Set-up role based access control in Laravel, so the Laravel 5.7 Users and Roles Management for this example is following below.

Step 1: Setting Up & Migrating the Database:

Add a new role column to our User Table existing user migration:

Schema::create('users', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name');
    $table->string('email')->unique();
    $table->string('password');
    $table->string('role');// the Laravel Based role column
    $table->rememberToken();
    $table->timestamps();
});
 

Run laravel migrate specific table:

php artisan migrate

Step 2: Customise the registration form:

authentication scaffolding

Custom Registration Form with Validation

php artisan make:auth

resources/views/auth/register.blade.php

<h3>Registration</h3>
<div class="form-group row">
    <label for="role" class="col-md-4 col-form-label text-md-right">Role</label>

    <div class="col-md-6">
        <select name="role" class="form-control" >
            <option value="admin">Admin</option>
            <option value="Employee">Employee</option>
            <option value="Manager">Manager</option>
        </select> 
    </div>
</div>

Step 3: Customize User Model and Register Controller:

User.php

//User.php
protected $fillable = [
    'name', 'email', 'password','role',
];
 

Step 4: Change simple RegisterController.php

app/Http/Controllers/Auth

protected function validator(array $data)
{
    return Validator::make($data, [
        'name' => 'required|string|max:255',
        'email' => 'required|string|email|max:255|unique:users',
        'password' => 'required|string|min:6|confirmed',
        'role' => 'required|in:admin,Employee,Manager', //validate role input
    ]);
}
protected function create(array $data)
{
    return User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => bcrypt($data['password']),
        'role' => $data['role'],
    ]);
} 

Step 5: Laravel 5.7 Create Custom Middleware:

create middlewares using CLI

php artisan make:middleware Admin
php artisan make:middleware Employee
php artisan make:middleware Manager

Step 6: Laravel middlewares Source code

app/Http/Middleware/Admin.php

use Auth; //at the top

function handle($request, Closure $next)
{
    if (Auth::check() && Auth::user()->role == 'admin') {
        return $next($request);
    }
    elseif (Auth::check() && Auth::user()->role == 'Employee') {
        return redirect('/Employee');
    }
    else {
        return redirect('/Manager');
    }
}

app/Http/Middleware/Employee.php

use Auth; //at the top

function handle($request, Closure $next)
{
    if (Auth::check() && Auth::user()->role == 'Employee') {
        return $next($request);
    }
    elseif (Auth::check() && Auth::user()->role == 'Manager') {
        return redirect('/Manager');
    }
    else {
        return redirect('/admin');
    }
}

app/Http/Middleware/Manager.php

use Auth; //at the top

function handle($request, Closure $next)
{
    if (Auth::check() && Auth::user()->role == 'Manager') {
        return $next($request);
    }
    elseif (Auth::check() && Auth::user()->role == 'Employee') {
        return redirect('/Employee');
    }
    else {
        return redirect('/admin');
    }
}

Step 7: Add the middleware classes to $routeMiddleware

app/Http/Kernel.php

protected $routeMiddleware = [
    // ...
    'admin' => 'App\Http\Middleware\Admin',
    'Employee' => 'App\Http\Middleware\Employee',
    'Manager' => 'App\Http\Middleware\Manager',
];

web.php:

Route::get('/admin', function(){
    echo "Welcome To Admin";
})->middleware('auth','admin');

Route::get('/Employee', function(){
    echo "Welcome To Employee";
})->middleware('auth','Employee');

Route::get('/Manager', function(){
    echo "Welcome To Manager";
})->middleware('auth','Manager');

middleware in a controller’s constructor,

public function __construct()
{
    $this->middleware('auth');  
    $this->middleware('admin');
}

Step 8: Laravel Redirect User After Sign-in:

LoginController.php

protected function redirectTo( ) {
    if (Auth::check() && Auth::user()->role == 'Manager') {
        return redirect('/Manager');
    }
    elseif (Auth::check() && Auth::user()->role == 'Employee') {
        return redirect('/Employee');
    }
    else {
        return redirect('/admin');
    }
}

Bonus For Implementing Roles & Permissions in Laravel

Roles and permissions database migrations

items

Column Type Null Default Links to
id (Primary) int(10) No
title varchar(255) No
description text No
created_at timestamp Yes NULL
updated_at timestamp Yes NULL

Indexes

No index defined!
Keyname Type Unique Packed Column Cardinality Collation Null Comment
PRIMARY BTREE Yes No id 0 A No

migrations

Column Type Null Default Links to
id (Primary) int(10) No
migration varchar(255) No
batch int(11) No

Indexes

No index defined!
Keyname Type Unique Packed Column Cardinality Collation Null Comment
PRIMARY BTREE Yes No id 4 A No

password_resets

Column Type Null Default Links to
email varchar(255) No
token varchar(255) No
created_at timestamp Yes NULL

permissions

Column Type Null Default Links to
id (Primary) int(10) No
name varchar(255) No
display_name varchar(255) Yes NULL
description varchar(255) Yes NULL
created_at timestamp Yes NULL
updated_at timestamp Yes NULL

Indexes

No index defined!
Keyname Type Unique Packed Column Cardinality Collation Null Comment
PRIMARY BTREE Yes No id 8 A No

permission_role

Column Type Null Default Links to
permission_id (Primary) int(10) No permissions -> id
role_id (Primary) int(10) No roles -> id

Indexes

No index defined!
Keyname Type Unique Packed Column Cardinality Collation Null Comment
PRIMARY BTREE Yes No permission_id 5 A No
role_id 5 A No
permission_role_role_id_foreign BTREE No No role_id 2 A No

roles

Column Type Null Default Links to
id (Primary) int(10) No
name varchar(255) No
display_name varchar(255) Yes NULL
description varchar(255) Yes NULL
created_at timestamp Yes NULL
updated_at timestamp Yes NULL

Indexes

No index defined!
Keyname Type Unique Packed Column Cardinality Collation Null Comment
PRIMARY BTREE Yes No id 2 A No

role_user

Column Type Null Default Links to
user_id (Primary) int(10) No users -> id
role_id (Primary) int(10) No roles -> id

Indexes

No index defined!
Keyname Type Unique Packed Column Cardinality Collation Null Comment
PRIMARY BTREE Yes No user_id 2 A No
role_id 2 A No
role_user_role_id_foreign BTREE No No role_id 2 A No

users

Column Type Null Default Links to
id (Primary) int(10) No
name varchar(255) No
email varchar(255) No
password varchar(255) No
remember_token varchar(100) Yes NULL
created_at timestamp Yes NULL
updated_at timestamp Yes NULL

Indexes

No index defined!
Keyname Type Unique Packed Column Cardinality Collation Null Comment
PRIMARY BTREE Yes No id 0 A No
Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Role based access control using Laravel 5.7 Example.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Concat Multiple MySQL Rows GROUP_CONCAT 0

Concat Multiple MySQL Rows GROUP_CONCAT

Today, We want to share with you Concat Multiple MySQL Rows GROUP_CONCAT.In this post we will show you Combine Multiple child rows into one row MYSQL, hear for Select Multiple Rows and Combine / Insert into One Row using MYSQL we will give you demo and example for implement.In this post, we will learn about Concatenate multiple MySQL rows into one field using GROUP_CONCAT with an example.

Concat Multiple MySQL Rows GROUP_CONCAT

There are the Following The simple About Concat Multiple MySQL Rows GROUP_CONCAT Full Information With Example and source code.

As I will cover this Post with live Working example to develop MySQL Concat Multiple Rows Into A Single Row, so the mysql – Combining multiple rows into single column for this example is following below.

Simple MySQL Concat Multiple Rows Into A Only 1 MySQL Row is less want to thing while simple Mysql querying.

Within the MySQL Table

SELECT ID, GROUP_CONCAT(cats SEPARATOR ', ') FROM Members_cats GROUP BY ID

With Other MySQL Table

SELECT member.ID, member.email, GROUP_CONCAT(cat.name SEPARATOR ', ') , member.status FROM `Members`as member, `Members_cats` as cat WHERE member.ID = cat.member_id GROUP BY member.ID ORDER BY member.ID DESC

Example : Mysql group_concat multiple columns

MySQL 3 Tables

CREATE TABLE `displays` (
  `display_id` int(2) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  PRIMARY KEY (`display_id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

CREATE TABLE `students` (
  `stud_id` int(2) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  PRIMARY KEY (`stud_id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

CREATE TABLE `display_student` (
  `id` int(2) NOT NULL AUTO_INCREMENT,
  `display_id` int(2) NOT NULL,
  `stud_id` int(2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

using GROUP_CONCAT

SELECT display_id, GROUP_CONCAT(DISTINCT stud_id ORDER BY stud_id) AS stud_id_list FROM display_student GROUP by display_id ORDER BY display_id

simple MySQL modify query as well as use the GROUP_CONCAT and GROUP

SELECT s.name AS `show`, 
GROUP_CONCAT(p.name ORDER BY p.name SEPARATOR ', ' ) AS team
FROM display_student sp, displays s, students p 
WHERE sp.display_id = s.display_id AND sp.stud_id = p.stud_id 
GROUP BY sp.display_id ORDER BY s.name

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Concat Multiple MySQL Rows GROUP_CONCAT.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

PHP Multiple images upload using jQuery Ajax 0

PHP Multiple images upload using jQuery Ajax

Today, We want to share with you PHP Multiple images upload using jQuery Ajax.
In this post we will show you Multiple images upload using jQuery, Ajax and PHP, hear for PHP AJAX Multiple Image Upload using jQuery we will give you demo and example for implement.
In this post, we will learn about Upload Multiple Images using jQuery, Ajax and PHP with an example.

index.html



<title>Multiple images upload using jQuery, Ajax and PHP : Pakainfo.com</title>




$(document).ready(function(){
	$('#allimages_data').on('change',function(){
		$('#images_multipleform').ajaxForm({
			target:'#display_images_preview',
			beforeSubmit:function(e){
				$('.uploading').show(); //all images display
			},
			success:function(e){
				$('.uploading').hide(); //hide first images
			},
			error:function(e){
			}
		}).submit();
	});
});




<div style="margin-top:20px">
	<div class="upload_div">
    <form method="post" name="images_multipleform" id="images_multipleform" enctype="multipart/form-data" action="do_upload_data.php" class="well">
    	
            <label>Please local system choose Image</label>
            
        <div class="uploading none">
            <label> </label>
            <img src="images/uploading.gif" />
        </div>
    </form>
    </div>
	
    <div class="gallery" id="display_images_preview"></div>
</div>

<hr />

<h1>Solution of AngularJs All Problems For Pakainfo.com</h1>
<h3>
<a href="https://pakainfo.com/">My First Web-Application in angularjs, So I am very happy and 1000+  more then people are used of Pakainfo.com </a>
</h3>

	

do_upload_data.php

$val){
		$image_name = $_FILES['allimages']['name'][$key];
		$tmp_name 	= $_FILES['allimages']['tmp_name'][$key];
		$size 		= $_FILES['allimages']['size'][$key];
		$type 		= $_FILES['allimages']['type'][$key];
		$error 		= $_FILES['allimages']['error'][$key];

		$store_target_dir = "uploads/";
		$store_target_file_images = $store_target_dir.$_FILES['allimages']['name'][$key];
		//all multiple images uploded here move uploads folder
		if(move_uploaded_file($_FILES['allimages']['tmp_name'][$key],$store_target_file_images)){
			$allimages_arr[] = $store_target_file_images;
		}
	}
}
?>

style.css

ul, ol, li {
	margin: 0;
	padding: 0;
	list-style: none;
}
.gallery{ width:100%; float:left; margin-top:30px;}
.gallery ul{ margin:0; padding:0; list-style-type:none;}
.gallery ul li{ padding:7px; border:2px solid #ccc; float:left; margin:10px 7px; background:none; width:auto; height:auto;}
.gallery img{ width:250px;}
.none{ display:none;}
.upload_div{ margin-bottom:50px;}
.uploading{ margin-top:15px;}

Laravel 5.7 Delete Confirm Bootstrap jQuery Model 0

Laravel 5.7 Delete Confirm Bootstrap jQuery Model

Today, We want to share with you Laravel 5.7 Delete Confirm Bootstrap jQuery Model.In this post we will show you Delete Modal Popup with Laravel 5.7, Bootstrap and jQuery, hear for Laravel 5.7 – Confirmation before delete record from database example we will give you demo and example for implement.In this post, we will learn about Laravel 5.7 – confirmation box for delete a member from database with an example.

Laravel 5.7 Delete Confirm Bootstrap jQuery Model

There are the Following The simple About Laravel 5.7 Delete Confirm Bootstrap jQuery Model Full Information With Example and source code.

As I will cover this Post with live Working example to develop , so the Use bootstrap dynamic modal for delete confirmation (laravel 5.7) for this example is following below.

Step : 1 Define Route

routes/web.php

Route::get('products', '[email protected]')->name('products');
Route::delete('products/{id}', '[email protected]')->name('product-delete');

Step : 2 Create Laravel Controller

app/Http/Controllers/ProductController.php file in

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use DB;
use Session;

class ProductController extends Controller
{
    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $products = DB::table("products")->get();
        return view('products',compact('products'));
    }

    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
    	DB::table("products")->delete($id);
    	Session::put('success', 'Your Record Deleted Successfully.');
    	return redirect()->route('products');
    }
}

Step : 3 Define a Laravel blade/view File

resources/views/product.blade.php

@extends('layouts.app')
@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-default">
                @if ($message = Session::get('success'))
                <div class="product-default-alerts alert alert-success fade in">
                    <button type="button" class="close"></button>
                    {!! $message !!}
                </div>
                
                @endif                
                <div class="panel-heading">All Posts</div>
                <div class="panel-body">
                    <table class="table table-bordered">
                    	<thead>
                    		<tr>                    			
	                    		<th>Title</th>
	                    		<th>Description</th>
	                    		<th>Action</th>
                    		</tr>
                    	</thead>
                    	<tbody>
                            @foreach($product as $key => $value)
                                <tr>
                                    <td>{!! $value->title !!}</td>
                                    <td>{!! $value->description !!}</td>
                                    <td>
                                        <a class="btn btn-danger waves-effect waves-light remove-record">id) !!}" data-id="{{$value->id}}" data-target="#product-default-width-modal">Delete</a>
                                    </td>
                                </tr>
                            @endforeach                            
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- Delete Product Model -->
<form action="" method="POST" class="product-delete-record-model">
    <div id="product-default-width-modal" class="modal fade" role="dialog">
        <div class="modal-dialog" style="width:55%">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close">×</button>
                    <h4 class="modal-title" id="product-default-width-modalLabel">Delete Record</h4>
                </div>
                <div class="modal-body">
                    <h4>You Want You Sure Delete This Record?</h4>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default waves-effect remove-data-from-delete-form">Close</button>
                    <button type="submit" class="btn btn-danger waves-effect waves-light">Delete</button>
                </div>
            </div>
        </div>
    </div>
</form>
@endsection

@section('script')

@endsection	

Step : 4 Main product-default.js File include

public/product-default.js

$(document).ready(function(){
	// For A Delete Record Popup
	$('.remove-record').click(function() {
		var id = $(this).attr('data-id');
		var url = $(this).attr('data-url');
		var token = CSRF_TOKEN;
		$(".product-delete-record-model").attr("action",url);
		$('body').find('.product-delete-record-model').append('');
		$('body').find('.product-delete-record-model').append('');
		$('body').find('.product-delete-record-model').append('');
	});

	$('.remove-data-from-delete-form').click(function() {
		$('body').find('.product-delete-record-model').find( "input" ).remove();
	});
	$('.modal').click(function() {
		// $('body').find('.product-delete-record-model').find( "input" ).remove();
	});
});

Run Laravel Project

php artisan serve
http://localhost:8000/products

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Laravel 5.7 Delete Confirm Bootstrap jQuery Model.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Laravel Open link in new tab Example 0

Laravel Open link in new tab Example

Today, We want to share with you Laravel Open link in new tab Example.In this post we will show you controller redirect to url in laravel, hear for laravel open link in new tab automatically we will give you demo and example for implement.In this post, we will learn about laravel open new tab with content with an example.

Laravel Open link in new tab Example

There are the Following The simple About Laravel Open link in new tab Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop laravel open pdf in new tab, so the some redirect to a view in laravel for this example is following below.

laravel redirect to a new tab

Redirect::away() 
//or
Redirect:to()

Yes, it’s Working Fine.

public function away($path, $status = 302, $headers = array())
{
    return $this->createRedirect($path, $status, $headers);
}

How to Open URL in New Tab using Laravel?

Simple open PDF view page in new tab in laravel 5 using controller code

<a target="_blank"> click me to Generated pdf </a>

Add Your Laravel Controller

public function createpdf(Request $request){
  $product = ProductDetail::find($product->id);
  $data["info"] = $product;
  $pdf = PDF::loadView('myproductlist', $data);
  return $pdf->stream('myproductlist.pdf');
}

Add Your Laravel Route

Route::get('/pdf', '[email protected]')->name('createpdf');

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Laravel Open link in new tab Example.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Polymorphic One to Many Relationship Example 0

Polymorphic One to Many Relationship Example

Today, We want to share with you Polymorphic One to Many Relationship Example.In this post we will show you , hear for Laravel 5.7 One to Many Polymorphic Relationship we will give you demo and example for implement.In this post, we will learn about One-To-Many polymorphic relationship with an example.

Polymorphic One to Many Relationship Example

There are the Following The simple About Polymorphic One to Many Relationship Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop Eloquent Polymorphic One to Many Relationships, so the Laravel-Many-to-one Polymorphic relationship for this example is following below.

Laravel Eloquent Relationships Tutorial with Examples

Example details:

In this Example we have 3 models (Boy, Girl and Mobile), and 3 tables (boy, girl and mobiles).

Business Rules:

  • The Boy (customer) can buy many Mobiles.
  • The Girl (customer) can buy many Mobiles.
  • The Mobile can be bought by one customer (Boy or Girl).

Relationship Details:

The Mobile table should store the Customer ID and the Customer Type.
“customer” is a name given to a group of models (Boy and Girl). And it’s not limited to two. The customer type is the real name of the model.

Laravel 5.7 Eloquent Models:

class Boy
{
    public function mobiles()
    {
        return $this->morphMany(Mobile::class, 'customer');
    }
}
class Girl
{
    public function mobiles()
    {
        return $this->morphMany(Mobile::class, 'customer');
    }
}
class Mobile
{
    public function customer()
    {
        return $this->morphTo();
    }
}

Laravel Define Database Migrations:

Schema::create('boy', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name');
});
Schema::create('girl', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name');
});
Schema::create('mobiles', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name');
    $table->integer('customer_id')->unsigned()->index()->nullable();
    $table->string('customer_type')->nullable();   
    // or use $table->morphs(‘customer’); instead of "customer_id" and "customer_type"
});

Store/Save Database Records:

// Create relation between customer (Boy/Girl) and Mobile.
$boy->mobiles()->saveMany([
   $mobile1, 
   $mobile2,
]);
$girl->mobiles()->saveMany([
   $mobile1, 
   $mobile2,
]);
// Or use the save() function for single model.
$boy->mobiles()->save($mobile);
$girl->mobiles()->save($mobile);

// Create relation between Mobile and customer (Boy/Girl).
$mobile1->customer()->associate($boy)->save();
$mobile2->customer()->associate($girl)->save();

Retrieve/fetch Records:

// Get customer (Boy/Girl) Mobiles
$boy->mobiles
$girl->mobiles

// Get Mobile customer (Boy and Girl)
$mobile->customer

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Polymorphic One to Many Relationship Example.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Fixed Sticky Header scrolling in JQuery Example 0

Fixed Sticky Header scrolling in JQuery Example

Today, We want to share with you Fixed Sticky Header scrolling in JQuery Example.In this post we will show you Fixed sticky header when scrolling, hear for smooth sticky header on scroll jquery we will give you demo and example for implement.In this post, we will learn about Facebook Style Scroll Fixed Header in JQuery with an example.

Fixed Sticky Header scrolling in JQuery Example

There are the Following The simple About Fixed Sticky Header scrolling in JQuery Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop sticky header on scroll jquery, so the fixed header on scroll html for this example is following below.

Fixed sticky header when scrolling

The HTML Part

<HTML>
<HEAD>
	<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
	<title>jQuery Examples - Scroll Fixed Header like Facebook in JQuery - pakainfo.com</title>
</HEAD>
<BODY>

<div id="header_part">
	<h1>Simple Scroll Fix Header like Facebook in JQuery</h1>
</div>

<p>Create A Facebook Like Sticky Sidebar - jQuery Examples<br/><br/><br/><br/><br/></p>
<p> jQuery Fixed Header - Fixed Position Div Plugin with Examples<br/><br/><br/><br/><br/></p>
<p>jquery - CSS and HTML5 for this fixed header on scroll<br/><br/><br/><br/><br/></p>
<p>Sticky Sidebar Scroll Jquery Plugin - Stop Sidebar Scroll at End<br/><br/><br/><br/><br/></p>
<b>fixing a sidebar while scrolling, until bottom with jquery</b>
</BODY>
</HTML>

The JQuery Part

<SCRIPT>
$(document).ready(function() {

	var div = $('#header_part');
	var start = $(div).offset().top;

	$.event.add(window, "scroll", function() {
		var p = $(window).scrollTop();
		$(div).css('position',((p)>start) ? 'fixed' : 'static');
		$(div).css('top',((p)>start) ? '0px' : '');
	});

});
</SCRIPT>

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Fixed Sticky Header scrolling in JQuery Example.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Multiple Checkbox Check Uncheck All using jQuery 0

Multiple Checkbox Check Uncheck All using jQuery

Today, We want to share with you Multiple Checkbox Check Uncheck All using jQuery.In this post we will show you select multiple rows with checkboxes using jquery datatable, hear for Select/Deselect all checkboxes using jQuery we will give you demo and example for implement.In this post, we will learn about jQuery: Check Uncheck All / Select Deselect All CheckBoxes in HTML with an example.

Multiple Checkbox Check Uncheck All using jQuery

There are the Following The simple About Multiple Checkbox Check Uncheck All using jQuery Full Information With Example and source code.

As I will cover this Post with live Working example to develop jquery select all checkboxes in table column, so the jquery multiselect checkbox select all for this example is following below.

select all checkbox jquery

The HTML Part

<HTML>
<HEAD>
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
	<TITLE>Multiple Checkbox Select/Deselect - pakainfo.com</TITLE>
</HEAD>
<BODY>
	<H2>Multiple Checkbox Select/Deselect - pakainfo.com</H2>
<table border="1">
<tr>
	<th><input type="checkbox" id="checkAll"/></th>
	<th>Product</th>
	<th>Price</th>
</tr>
<tr>
	<td align="center"><input type="checkbox" class="product-details" name="product-details" value="1"/></td>
	<td>Laptop</td>
	<td>USD 98256</td>
</tr>
<tr>
	<td align="center"><input type="checkbox" class="product-details" name="product-details" value="2"/></td>
	<td>Samsung Galaxy</td>
	<td>USD 25</td>
</tr>
<tr>
	<td align="center"><input type="checkbox" class="product-details" name="product-details" value="3"/></td>
	<td>Iphone</td>
	<td>USD 120</td>
</tr>
<tr>
	<td align="center"><input type="checkbox" class="product-details" name="product-details" value="4"/></td>
	<td>Books</td>
	<td>USD 120</td>
</tr>
<tr>
	<td align="center"><input type="checkbox" class="product-details" name="product-details" value="5"/></td>
	<td>Apple iPhone 4</td>
	<td>USD 250</td>
</tr>
</table>

</BODY>
</HTML>

The jQuery Code

Add following jQuery source code in HTML part in HEAD section of above Example

<SCRIPT language="javascript">
$(function(){

	$("#checkAll").click(function () {
		  $('.product-details').attr('checked', this.checked);
	});

	$(".product-details").click(function(){

		if($(".product-details").length == $(".product-details:checked").length) {
			$("#checkAll").attr("checked", "checked");
		} else {
			$("#checkAll").removeAttr("checked");
		}

	});
});
</SCRIPT>

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Multiple Checkbox Check Uncheck All using jQuery.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.