Installing APC for php Accelerator xampp/WAMP 0

Installing APC for php Accelerator xampp/WAMP

Today, We want to share with you Installing APC for php Accelerator xampp/WAMP.
In this post we will show you How To install APC Cache on WAMP/XAMPP, hear for how to install PHP Accelerator in Xampp we will give you demo and example for implement.
In this post, we will learn about Installing APC for PHP 7 Accelerator xampp/WAMP with an example.

How to install PHP Accelerator in Xampp ?

The PHP first of all php accelerator download and It’s should Internationalization extension is used to php accelerator wamp/xampp, amongst more, by PHP based Symfony (for some more validators) for install and/or enable a php accelerator (highly recommended).

This php accelerator xampp extension allows you to write source codes like this one Example:

$php_accelerator_xampp_format = new NumberFormatter('en_US', NumberFormatter::DECIMAL);
echo $php_accelerator_xampp_format->format(1234567.89); // 1,234,567.89

$php_accelerator_xampp_format = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
echo $php_accelerator_xampp_format->format(1234567.89); // 1 234 567,89

$php_accelerator_xampp_format = new NumberFormatter('en_US', NumberFormatter::CURRENCY);
echo $php_accelerator_xampp_format->getTextAttribute(NumberFormatter::CURRENCY_CODE); // USD

$php_accelerator_xampp_format = new NumberFormatter('pt_BR', NumberFormatter::CURRENCY);
echo $php_accelerator_xampp_format->getTextAttribute(NumberFormatter::CURRENCY_CODE); // BRL

After that Therefor much more, including install and/or enable a php accelerator (highly recommended). prestashop formatting of currency, install and/or enable a php accelerator, number and date/time, php accelerator ampps as well as UCA-conformant collations php accelerator cpanel (customizable all the method to compare two php_apc.dll php 7 strings).

install php accelerator To activate this PHP simple install apc on xampp extension in Xampp, just simple edit your file Like as a php.ini (Example in C:\xampp\php folder) and remove the semicolon to uncomment this line :

;extension=php_intl.dll

Note : : Lastly You don’t forget to Your PHP restart Apache !

We hope you get an idea about How to install Alternative PHP Cache(APC) in Xampp
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!.

VueJS Bar and Star Rating Component and demo 0

VueJS Bar and Star Rating Component and demo

VueJS Bar and Star Rating Component and demo

In this Post We Will Explain About is VueJS Bar and Star Rating Component and demo With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Vuejs rating component Example

In this post we will show you Best way to implement VueJS Bar Rating Component and demo, hear for star rating Vuejs examples free download with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Include External Libs

index.html

<!-- Devloped by Pakainfo.com free download examples -->
<div id="liveApp">
    <h1>Example of the Star rating in vue.js demo</h1>
    <ul>
        <li>
            <p>{{product.name}}: {{product.level}}</p>
            
        </li>
    </ul>
    <pre>{{webdev | json}}</pre>
</div>

index.js

// Devloped by Pakainfo.com free download examples -->
Vue.component('live-star-rating', {
  props: {
    'name': String, //Datatype string
    'value': null,
    'real_val': null,
    'id': String,  //Datatype string
    'disabled': Boolean,//true or false
    'required': Boolean  //true or false
  },
  template: '<div class="live-star-rating">\
        <label class="live-star-rating__star">= rating) && value != null), \'is-hover\': ((real_val >= rating) && real_val != null), \'is-disabled\': disabled}" \
        v-on:click="set(rating)" v-on:mouseover="star_over(rating)" v-on:mouseout="star_out">\
        ★</label></div>',

  data: function() {
    return {
      temp_value: null,
      liveAllRates: [1, 2, 3, 4, 5]
    };
  },
  methods: {
    star_over: function(index) {
      var self = this;

      if (!this.disabled) {
        this.temp_value = this.real_val;
        return this.real_val = index;
      }

    },

    star_out: function() {
      var self = this;

      if (!this.disabled) {
        return this.real_val = this.temp_value;
      }
    },
	//set value
    set: function(value) {
      var self = this;
	//check value
      if (!this.disabled) {        
        this.temp_value = value;
        return this.value = value;
      }
    }
  }

});

new Vue({
  el: '#liveApp',
  data: {
  	webdev: [
    	{name: "Live24u", level: 4},
			{name: "Vuejs", level: 3}
    ]
  }
});

style.css

.live-star-rating__star.is-selected,
.live-star-rating__star.is-hover {
  color: #FFD700;
}
.live-star-rating__star.is-disabled:hover {
  cursor: default;
}
pre{
  background: #1d1d1d;
  border: 2px solid #3d3d3d;
  padding: 18px;
  border-radius: 3px;
}
.live-star-rating__star {
  display: inline-block;
  line-height: 1;
  font-size: 1.5em;
  color: #ABABAB;
  padding: 3px;
  vertical-align: middle;
  transition: color .2s ease-out;
}
.live-star-rating__checkbox {
  position: absolute;
  height: 2px;
  width: 2px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  margin: -2px;
  padding: 0;
  border: 0;
}
.live-star-rating__star:hover {
  cursor: pointer;
}

Example

You are Most welcome in my youtube Channel Please subscribe my channel. and give me Feed Back.
More Details……
Angularjs Example

Example

I hope you have Got What is Vuejs rating component And how it works.I would Like to have Feed Back From My Blog(Pakainfo.com) readers.Your Valuable Feed Back,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

VueJS Disable enable Selector Examples 0

VueJS Disable enable Selector Examples

Today, We want to share with you VueJS Disable enable Selector Examples.In this post we will show you How to enable/disable an element using vuejs Example, hear for How to enable/disable text field using Vue.js? we will give you demo and example for implement.In this post, we will learn about How to Disable All Input Controls Inside a Form Using Vue JS with an example.

VueJS Disable enable Selector Examples

There are the Following The simple About VueJS Disable enable Selector Examples Full Information With Example and source code.

As I will cover this Post with live Working example to develop Enabling and Disabling text field using VueJS, so the vue.js disable input conditionally for this example is following below.

Example 1 Vue.JS Disable Selector Example

Here is the sample HTML file with Vue JS solution:

//Include vuejs CDN
https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.25/vue.js
<div id="mylive_app">
<h2>vue.js disable input conditionally</h2>
  <button>Click To 2 Time Enable</button>
  
    
  <pre>{{ $data | json }}</pre>
</div>

var app = new Vue({
  el: '#mylive_app',

  data: {
    disabled: 0,
  },
}); 

Vue JS button enable / disable with Demo
Angular 6 CRUD Operations Application Tutorials

Read :

Relavnt Keywords:vue :disabled not working, vue.js disable button after click, vue disable div, jquery disable button, html disabled using Vuejs, css disabled, vue select, vuejs disable component, Creating Custom Inputs With Vue.js, How to enable/disable an element using vuejs Example, Enabling and Disabling text field using VueJS, How to Disable All Input Controls Inside a Form Using Vue JS

Summary

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

I hope you get an idea about VueJS Disable enable Selector Examples.
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 Dynamic active menu Example Tutorial 0

Laravel Dynamic active menu Example Tutorial

Today, We want to share with you Laravel Dynamic active menu Example Tutorial.In this post we will show you laravel active menu item, hear for laravel request is and laravel request::is we will give you demo and example for implement.In this post, we will learn about laravel 5.7 navigation menu with an example.

Laravel Dynamic active menu Example Tutorial

There are the Following The simple About Laravel Dynamic active menu Example Tutorial Full Information With Example and source code.

As I will cover this Post with live Working example to develop laravel 5.7 active class with active states laravel, so the some major files and Directory structures for this example is following below.

LARAVEL ADDING CLASS .ACTIVE TO CURRENT LINK

step 1: Create a helpers.php

function isActive($path)
{
    return Request::is($path . '*') ? ' active' :  '';
}

step 2: Add in composer.json files

"autoload": {
        "classmap": [
            "database"
        ],
        "files": [
            "app/helpers.php"
        ],
        "psr-4": {
            "App\": "app/"
        }
    },

step 3: How to use it:

<ul class="nav navbar-nav">
     
    <li class="{{ isActive('products') }}">
       <a href="{{ url('products') }}"><i class="fa fa-fw fa-user"></i> Products</a>
    </li>
 
 </ul>

Laravel 5.7 active menu item using request

<li class="{{ Request::is('status*') ? 'active' : '' }}">
    <a href="{!! route('status.index') !!}"><span>Status</span></a>
</li>
<li class="{{ Request::is('users*') ? 'active' : '' }}">
    <a href="{!! route('users.index') !!}"><span>Users</span></a>
</li>
<li class="{{ Request::is('roles*') ? 'active' : '' }}">
    <a href="{!! route('roles.index') !!}"><span>Roles</span></a>
</li>

Highlight Active Nav Links using Laravel

We can use ternary operator with 3 Examples. For example, We can check dynamic URI for the current ul > li route:

using ternary operator

<li{{ request()->is('product-types') ? ' class="active"' : '' }}>

using * as wildcard:

<li{{ request()->is('product-type-number-*') ? ' class="active"' : '' }}>

using check route name

<li{{ request()->route()->getName() === 'ProductType.index' ? ' class="active"' : '' }}>

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 Dynamic active menu Example Tutorial.
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 Custom Namespaces Example Tutorial 0

Laravel Custom Namespaces Example Tutorial

Today, We want to share with you Laravel Custom Namespaces Example Tutorial.In this post we will show you Namespaces in Laravel Applications, hear for Laravel – Namespaces Example we will give you demo and example for implement.In this post, we will learn about Laravel 5.7 CRUD Example Tutorial For Beginners with an example.

Laravel Custom Namespaces Example Tutorial

There are the Following The simple About Laravel Custom Namespaces Example Tutorial Full Information With Example and source code.

As I will cover this Post with live Working example to develop Custom namespaces, so the Laravel – Namespaces with Custom namespaces for this example is following below.

Declaration of namespace

The use keyword allows the developers to shorten the namespace.

use <Your-namespace-name>;

Example

Laravel Create a simple user defined namespace

php artisan app:name InfoProduct

Namespaces

Simple common use-case for Lravel route groups is assigning the Like PHP namespace to a group of controllers using the namespace method:

Route::namespace('User')->group(function () {
    // Laravel 5.7 Controllers Within The "App\Http\Controllers\User" Namespace
});

Custom namespaces in Laravel Example

Calling Lang:

Lang::get('web::group.name');

@trans('web::group.name');

Calling Blade View:

view('web::index')

view('web::partials.sidebar')

Laravel Calling Config:

Config::get('web.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 Laravel Custom Namespaces Example Tutorial.
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 Pivot Tables Tutorial Example 0

Laravel Pivot Tables Tutorial Example

Today, We want to share with you Laravel Pivot Tables Tutorial Example.In this post we will show you Laravel multiple pivot table relationships, hear for Laravel 5.7 Role Management with Pivot Models we will give you demo and example for implement.In this post, we will learn about LARAVEL MANY-TO-MANY RELATIONS using Pivot Tables with an example.

Laravel Pivot Tables Tutorial Example

There are the Following The simple About Laravel Pivot Tables Tutorial Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop Pivot Tables Example in Laravel, so the LARAVEL MANY-TO-MANY RELATIONS using Pivot Tables for this example is following below.

Pivot table — is a table used for Join or connecting Laravel relationships between two tables.

Working with pivot table(many-to-many) relationship in Laravel with Example

$product->types()->sync([1, 2, 3]) ;

If laravel Pivot table have some additionls columns add as well as we want to retrives them then we have to identify in your laravel model while defining the pivot table(many-to-many) relationship.

return $this->belongsToMany('Product')->withPivot('details');

Custom Pivot Table Models

here see full example of the Laravel custom pivot table

I have three tables :

  • fruites (I call it “Product”)
  • Product Category (I call it “Category)
  • Product Supplay (I call it “Supplay”)

My relationship :

  • Product has many Category (duplex fruites)
  • Product has many Supplay
  • Category has many Product
  • Category has many Supplay
  • Supplay has one Category
  • Supplay has one Product

class Product extends Model
{
    public function CategoryProducts(){
        return $this->hasMany('App\Models\Company\CategoryProduct');
    }

    public function Supplays()
    {
        return $this->hasManyThrough('App\Models\Company\Supplay','App\Models\Company\CategoryProduct', 'Category_id', 'Category_Product_id');
    }
}

class Category extends Model
{
    public function ProductCategorys()
    {
        return $this->hasMany('App\Models\Company\CategoryProduct');
    }

}

class CategoryProduct extends Model
{

    protected $table = 'Category_Product';

    public function Product(){
        return $this->belongsTo('App\Models\Company\Product');
    }

    public function Category(){
        return $this->belongsTo('App\Models\Company\Category');
    }

    public function Supplays()
    {
        return $this->hasMany('App\Models\Company\Supplay','Category_Product_id');
    }
}

class Supplay extends Model
{

    public function type(){
        return $this->belongsTo('App\Models\Company\Type');
    }

    public function CategoryProduct(){
        return $this->belongsTo('App\Models\Company\CategoryProduct','Category_Product_id');
    }

}
[/php

[php]
$fruites = Product::with('CategoryProducts','CategoryProducts.Category', 'Supplays')->first();
dd($fruites->Supplays);
foreach($fruites->CategoryProducts as $CategoryProduct){
    dd($CategoryProduct->Category);
}
[/php

[php]
$fruitess = Product::with('CategoryProducts','CategoryProducts.Category', 'Supplays')->withCount('Supplays')->get();

foreach($fruitess as $fruites){
    dd($fruites->Supplays_count);
    dd($fruites->Supplays); //direct Supplays for each fruites
    foreach($fruites->CategoryProducts as $CategoryProduct){
        dd($CategoryProduct->Category);
    }
}    

laravel pivot table migration

Create Laravel a new migration

php artisan make:migration create_alpha_beta_table --create --table=alpha_beta

Example: laravel pivot table

//get user by id
$user = App\User::find(1);

//get roles of this user
foreach ($user->roles as $role) {

  //pivot attribute returns a model which represent user_role table
  echo $role->pivot->created_at;

}
[/php

<p>create a Laravel class by extending pivot</p>
[php]
class Product extends Model
{
    /**
     * The users that belong to the role.
     */
    public function Cats()
    {
        return $this->belongsToMany('App\Cat')->using('App\Cat_Product');
    }
}

class Cat extends Model
{
    /**
     * The users that belong to the role.
     */
    public function Products()
    {
        return $this->belongsToMany('App\Product')->using('App\Cat_Product');
    }
}

class Cat_Product extends Pivot
{
    //
}

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 Pivot Tables Tutorial 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.

PHP Array Length Size Count Tutorial With Example 0

PHP Array Length Size Count Tutorial With Example

Today, We want to share with you PHP Array Length Size Count Tutorial With Example.In this post we will show you php count array elements with specific value, hear for we will give you demo and example for implement.In this post, we will learn about PHP Count total items in a multidimensional array/ associative array with an example.

PHP Array Length Size Count Tutorial With Example

There are the Following The simple About PHP Array Length Size Count Tutorial With Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop php array count values multidimensional array, so the Counts all elements in an array, or something in an object for this example is following below.

How to Count Array Elements in PHP

$num = array(1, 2, 3, array(4, 5, 6));
echo count($num)."\n";
echo count($num, 1);
//4 7

sizeof()

Array length Using PHP sizeof()

<?php

$mydata = array(5, 6, 7, array(8, 9, 10));
echo sizeof($mydata)."\n";
echo sizeof($mydata, 1);
//4 7
?>

PHP Indexed Arrays using Count

<?php
$product = array("Mobile", "Bike", "Computer");
$length = count($product);

for($x = 0; $x < $length; $x++) {
    echo $product[$x];
    echo "<br>";
}

How To Get Arrays Length

<?php
   $product = array("Mobile", "Bike", "Apple");
   $length = count($product);
   echo $length;
?>

Loop Through an Indexed Array

<?php
$product = array("Mobile", "Bike", "Computer");
$length = count($product);

for($x = 0; $x < $length; $x++) {
    echo $product[$x];
    echo "<br>";
}

PHP Loop Through an Associative Array

 $product = array("Mobile"=>"12566", "Bike"=>"98989", "Apple"=>"21");
 foreach($product as $x => $x_value) { 
 echo "Key=" . $x . ", Value=" . $x_value;
 echo "<br>";
}

Counting multidimensional arrays

php array count values multidimensional array

$devloperInfo = array( "devloper" => array( "Alfred shah", "Stanley sojitra", "Martin kumar", "deepak Lang" ),"languages" => array( "PHP", "Laravel", "Magento", "vuejs" ) );

// Displays "2"
echo count( $devloperInfo );

$devloperInfo = array( "devloper" => array( "mayur Hitchcock", "hitesh Kubrick", "Ravi Scorsese", "ketan Lang" ),"languages" => array( "PHP", "Laravel", "Angularjs", "Vuejs" ) );

// Displays "10"
echo count( $devloperInfo, COUNT_RECURSIVE );

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 PHP Array Length Size Count Tutorial With 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.

Laravel 5.6 Server Side Validation Example 0

Laravel 5.6 Server Side Validation Example Using Resource Controller

Today, We want to share with you Laravel 5.6 Server Side Validation Example Using Resource Controller.In this post we will show you server side api validation in laravel 5.7, hear for Laravel 5.7 Validation With Custom Rules Example From Scratch we will give you demo and example for implement.In this post, we will learn about Request based form validation with Laravel 5.7 with an example.

Laravel 5.6 Server Side Validation Example Using Resource Controller

There are the Following The simple About Laravel 5.6 Server Side Validation Example Using Resource Controller Full Information With Example and source code.

As I will cover this Post with live Working example to develop Laravel Form Validation- Server Side form validation, so the some Server side Validation for this example is following below.

Laravel 5.7 Server side Validation Example

resources/views/product/create.blade.php

Simple Create View Blade file For Server Side Laravel validation in Resource Controller

<form action="{{ route('product.store') }}" id="addproduct" method="POST">
    <input name="_token" type="hidden" value="{{ csrf_token() }}">
    <input type="hidden" name="user_id" value="{{ Auth::id() }}">
    <input type="hidden" name="add_product_form" value="1">
    <div class="modal-body">
        <div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
            <label class="control-label">product Name</label>
            <input type="text" class="form-control" name="name" value="{{Request::old('name')}}">
            @if ($errors->has('name'))
                <span class="help-block"><strong>{{ $errors->first('name') }}</strong></span>
            @endif
        </div>
        <div class="form-group {{ $errors->has('price') ? ' has-error' : '' }}">
            <label class="control-label">product price</label>
            <input type="number" class="form-control" name="price" value="{{Request::old('price')}}">
            @if ($errors->has('price'))
                <span class="help-block"><strong>{{ $errors->first('price') }}</strong></span>
            @endif
        </div>
        <div class="form-group {{ $errors->has('qty') ? ' has-error' : '' }}">
            <label class="control-label">product Age</label>
            <input type="number" class="form-control" name="qty" value="{{Request::old('qty')}}">
            @if ($errors->has('qty'))
                <span class="help-block"><strong>{{ $errors->first('qty') }}</strong></span>
            @endif
        </div>
    </div>
    <div class="modal-footer">
        <button class="btn btn-info" type="submit">Add</button>
        <button data-dismiss="modal" class="btn btn-default" type="button">Cancel</button>
    </div>
</form>

app/Http/Controllers/ProductController.php

public function store()
    {
        $rules = array(
            'name' => 'required|string|max:255',
            'price' => 'required|is_integer()',
            'qty' => 'required|is_integer()'
        );
        $params = $request->all();
        $validator = Validator::make($params, $rules);
        if ($validator->fails()) {
            $request->merge(array('add_product_form' => 1));
            //print_r($request->all());die('jjj');
            $input['add_product_form'] = '1';
            return redirect('product.create')
                        ->withErrors($validator)
                        ->withInput();
        } else {

            Product::create($request->all());

            flash()->success('The product has been created successfully.');

            return redirect()->route('product.index');  
        }
        
    }

Example 2 : Laravel Form Validation- Server Side form validation

Defining Routes

Route::get('sell', function(){
    return view('sell');
});
Route::post('sell', '[email protected]');

Creating Sell Form

<!DOCTYPE html>
<html>
<head>
<title>Get Product Online</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<form class="form-horizontal">
<fieldset>

<!-- Form Name -->
<legend>Fill the form to sell</legend>

<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="name">Name</label>  
<div class="col-md-4">
<input id="name" name="name" type="text" placeholder="Your Product Full Name" class="form-control input-md">

</div>
</div>

<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="product_code">product_code</label>  
<div class="col-md-4">
<input id="product_code" name="product_code" type="text" placeholder="P0001235" class="form-control input-md">

</div>
</div>

<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="productminmax">productminmax</label>  
<div class="col-md-4">
<input id="productminmax" name="productminmax" type="text" placeholder="+91" class="form-control input-md">

</div>
</div>

<!-- Multiple Radios (inline) -->
<div class="form-group">
<label class="col-md-4 control-label" for="producttype">producttype</label>
<div class="col-md-4"> 
<label class="radio-inline" for="producttype-0">
<input type="radio" name="producttype" id="producttype-0" value="Male">
Male
</label> 
<label class="radio-inline" for="producttype-1">
<input type="radio" name="producttype" id="producttype-1" value="Female">
Female
</label>
</div>
</div>

<!-- promo_code input-->
<div class="form-group">
<label class="col-md-4 control-label" for="promo_code">promo_code</label>
<div class="col-md-4">
<input id="promo_code" name="promo_code" type="text" placeholder="promo_code" class="form-control input-md">

</div>
</div>

<!-- promo_code input-->
<div class="form-group">
<label class="col-md-4 control-label" for="corfirm">Confirm promo_code</label>
<div class="col-md-4">
<input id="corfirm" name="corfirm" type="text" placeholder="Confirm promo_code" class="form-control input-md">

</div>
</div>

<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for=""></label>
<div class="col-md-4">
<input type="submit" class="btn btn-success" value="sell">
</div>
</div>

</fieldset>
</form>

</body>
</html>

Creating the Controller

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;

class ProductController extends Controller
{
//
 public function sell(Request $req){
  $Product = new \App\Product;
  $Product->name = $req->name;
  $Product->product_code= $req->product_code;
  $Product->productminmax = $req->productminmax;
  $Product->producttype = $req->producttype;
  $Product->promo_code = $req->promo_code;

  $Product->save();

  echo "Product Created Successfully";

 }
}

Simple Laravel Validation Logic

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;

class ProductController extends Controller
{
//
 public function sell(Request $req){

  $this->validate($req, [
   'name' => 'required',
   'product_code' => 'required|product_code',
   'productminmax' => 'required|max:10|min:10',
   'producttype' => 'required',
   'promo_code' => 'required|confirmed',
   'promo_code_confirmation' => 'required',
  ]);
  $Product = new \App\Product;
  $Product->name = $req->name;
  $Product->product_code= $req->product_code;
  $Product->productminmax = $req->productminmax;
  $Product->producttype = $req->producttype;
  $Product->promo_code = $req->promo_code;

  $Product->save();

  echo "Product Created Successfully";

 }
}

Displaying All the Errors

@if (count($errors) > 0)
 <div class="alert alert-danger">
 <ul>
  @foreach ($errors->all() as $error)
   <li>{{ $error }}</li>
  @endforeach
 </ul>
 </div>
@endif

Laravel Server side Form Validation- using AJAX Request and Validation

$("#form-id").submit(function(e){
 e.preventDefault();
 $.ajax({
  url: "Your_api_url",
  type: "POST",
  data: new FormData(this),
  contentType: false,
  cache: false,
  processData:false,
  success: function(data){
   //(Good Luck)do something on success
   //append div for success                       
  },
  error: function(data){
   var errors = data.responseJSON;
   for(i in errors){
    $("#div-id").append('<p>'+errors[i]+'</p>');
   }
  }           
 });
});

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.6 Server Side Validation Example Using Resource Controller.
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 5.7 Routing Required Parameter 0

Laravel 5.7 Routing Required Parameter

Today, We want to share with you Laravel 5.7 Routing Required Parameter.In this post we will show you laravel 5.7 routing Required parameters, hear for Routing Required parameters in laravel 5.7 we will give you demo and example for implement.In this post, we will learn about Route Required parameters in laravel 5.7 with an example.

Laravel 5.7 Routing Required Parameter

There are the Following The simple About Laravel 5.7 Routing Required Parameter Full Information With Example and source code.

As I will cover this Post with live Working example to develop route middleware,route parameters controller, so the some route redirect,get route parameters,get route name for this example is following below.

Example 1: Route with Required parameters

There are some more then 3 or more parameters pass which do not remain present within the web custom URL (Uniform Resource Locator), so the PHP or Laravel developers had to use them. Therefor Route parameters get indicated by a encapsulated within {} (curly-braces) with alphabets inside following source code the name of the URL parameter.

Route :: get ('product/{id}', function ($id) {
    echo 'Emp '.$id;
});

Example 2: Laravel (5.7) – Routing to controller with Required parameters

Required Route Parameter

You Can Also More Laravel Routing Examples Full Source Code ForLaravel Route pass multiple Parameters Examples

Routes.php

<?php
 
Route::get('products/{id}', [
    'uses' => '[email protected]',
    'as' => 'company.products',
    'middleware' => ['auth'],
]);
 
Route::post('update/{updateId}', [
    'uses' => '[email protected]',
    'as' => 'update',
]);

ProductController.php

namespace Henri\Http\Controllers;
 
use Auth;
use Henri\Models\Company;
use Henri\Models\Product;
use Illuminate\Http\Request;
 
class ProductController extends Controller{
        public function productCompany(){
                $products = Product::whereUserId(Auth::user()->id)->get();
                return view('company.index')->with('products', $products);
            }
            
            public function getProducts($id){
                $products = Product::where('id', $id)->first();
                if(!$products){
                    if (Auth::check()) {
                        return redirect()->route('company')->with('info', 'We cannot find that product!');
                    }
                }
                return view('company.products')->with('products', $products);   
            }
            
            public function updateProduct(Request $request, $updateId){
                $this->validate($request, [
                    'body' => 'max:255',
                ]);
                
                $products= Product::where('id', $updateId)->first()->update([
                    'body' => $request['body'],
                ]);
                
                return redirect()->back()->with('info', 'Product was updated!');
            }
 
}

Product.blade.php

@include('templates.partials.alerts')
 
@if(Auth::user()->id != $products->user_id)
    View this <a href="news/{{$products->id}}"/>news</a> !
@else
    <form action="{{route('update')}}" method="post">
        {{$products->id}}
    <textarea class="edit" name='body'/>{{$products->body}}</textarea>
    <br/>
    <br/>
    <input type="submit" name="editSubmit" value="Edit Product"/>
    <input type="hidden" name="_token" value="{{csrf_token()}}"/>
    </form>
@endif

Example 3: laravel get request Required parameters

# Required Parameters Template Routes

Route::get('student/{id}', function ($id) {
    return 'Student ID:'.$id;
});

You may define as many Laravel 5.7 route parameters as required by your route:

Route::get('students/{student}/comments/{comment}', function ($studentId, $commentId) {
    //
});

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 Routing Required Parameter.
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.