CoderFunda
  • Home
  • About us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • About us
  • Home
  • Php
  • HTML
  • CSS
  • JavaScript
    • JavaScript
    • Jquery
    • JqueryUI
    • Stock
  • SQL
  • Vue.Js
  • Python
  • Wordpress
  • C++
    • C++
    • C
  • Laravel
    • Laravel
      • Overview
      • Namespaces
      • Middleware
      • Routing
      • Configuration
      • Application Structure
      • Installation
    • Overview
  • DBMS
    • DBMS
      • PL/SQL
      • SQLite
      • MongoDB
      • Cassandra
      • MySQL
      • Oracle
      • CouchDB
      • Neo4j
      • DB2
      • Quiz
    • Overview
  • Entertainment
    • TV Series Update
    • Movie Review
    • Movie Review
  • More
    • Vue. Js
    • Php Question
    • Php Interview Question
    • Laravel Interview Question
    • SQL Interview Question
    • IAS Interview Question
    • PCS Interview Question
    • Technology
    • Other

07 September, 2020

Laravel Add , Update, Delete in Singal Page CRUD By Ajax Easy Way

 Programing Coderfunda     September 07, 2020     Laravel     No comments   


<?php 
Route:

Route::get('/cuisines','backEnd\contentManagement\CuisinesController@index');
Route::post('/data/cuisines','backEnd\contentManagement\
CuisinesController@cuisinesList');
Route::match(['get','post'],'/cuisine/add','backEnd\contentManagement\
CuisinesController@add');
Route::match(['get','post'],'/cuisine/edit/{cuisine_id}','backEnd\
contentManagement\CuisinesController@edit');
//soft-delete of cusisine
Route::match(['get','post'],'/cuisine/delete/{cuisine_id}','backEnd\
contentManagement\CuisinesController@delete');



?>
<!-- Controller -->

<?php

namespace App\Http\Controllers\backEnd\contentManagement;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Auth, Hash;
use App\Cuisine;


class CuisinesController extends Controller
{

    public function index()
        {
            $page = 'cuisines';
            return view('backEnd.contentManagement.cuisines.index', compact('page'));
        }

    public function cuisinesList(){
        
            $draw = @$_POST['draw'];
            $row = @$_POST['start'];
            $rowperpage = @$_POST['length']; // Rows display per page
            $columnIndex = @$_POST['order'][0]['column']; // Column index
            $columnName = @$_POST['columns'][$columnIndex]['data']; // Column name
            $columnSortOrder = @$_POST['order'][0]['dir']; // asc or desc
            $searchValue = @$_POST['search']['value']; // Search value

            $listing = Cuisine::select('*')
            ->whereNull('deleted_at')
            ->skip($_POST['start'])
            ->take($_POST['length']);

            $listing = $listing->orderBy($columnName,$columnSortOrder);

            $recordCount = Cuisine::whereNull('deleted_at')
            ->count();

            $with_filter_count = $listing->count();

            // ----- search
            if($searchValue != ''){

                $listing = $listing->where('name','like','%'.$searchValue.'%');
                $with_filter_count = $listing->count();
            }

            if($with_filter_count == 0){
                $with_filter_count = $recordCount;
            }

            $allRecords = $listing->get()->toArray();

            // Total number of records without filtering
            $totalRecords = $recordCount;

            //Total number of record with filtering
            $totalRecordwithFilter = $with_filter_count;
            $data = array();

            foreach ($allRecords as $key => $value) {

                $joined_on = date('d M, Y', strtotime($value['created_at']));
                $encoded_id = $value['id'];
                // $encoded_id = base64_encode($value['id']);

                $action = '<a href="'.url('/admin/cuisine/edit/'.$encoded_id). 
'" title="Edit"><i class="fa fa-edit"></i>
                </a>
                <a href="'.url('/admin/cuisine/delete/'.$encoded_id).'" 
title="Send Credential"><i class="fas fa-trash-alt"></i>
                </a>';

                $data[] = array(
                    "name"=>ucfirst($value['name']),
                    "action"=>$action,
                );
            }
           
            $response = array(
                "draw" => intval($draw),
                "iTotalRecords" => $totalRecords,
                "iTotalDisplayRecords" => $totalRecordwithFilter,
                "aaData" => $data
            );
            echo json_encode($response);
        }

    public function add(Request $request){
            if($request->isMethod('post')){
                $data = $request->all();
                //$id = $this->route('post');
                $validatedData = $request->validate
                ([
                    'name'=>'required|max:20|min:3',
                ]);

                $cusisineData = new Cuisine;
                $cusisineData->name = $data['name'];

                if($cusisineData->save())
                {
                    return redirect('/admin/cuisines')->with 
('success','Cuisine added successfully');
                }
                else
                {
                    return redirect('/admin/cuisines')
->with('errors',COMMON_ERROR);
                }
            }
            $page = 'cuisines';
            return view('backEnd.contentManagement.cuisines.form',
 compact('page'));
        }

    public function edit(Request $request,$cuisine_id)
        {
            $cuisine_detail = Cuisine::where('id',$cuisine_id)->first();
            if ($request->isMethod('post')){
                $data = $request->all();
                $this->validate($request,[
                    'name'=>'required|max:20|min:3',
                ]);          
                $cuisine_detail->name    = $data['name'];

                if ($cuisine_detail->save()) {
                    return redirect('/admin/cuisines')->with('success', 
'Cuisine Updated Successfully');
                }else{
                    return redirect()->back()->with('errors',COMMON_ERROR);
                }
            }
            $page = 'cuisines';
            return view('backEnd.contentManagement.cuisines.form',
 compact('page','cuisine_detail','cuisine_id'));
        }

    public function delete($cuisine_id)
        {
            $del = Cuisine::where('id',$cuisine_id)->update(['deleted_at'=>
 date('Y-m-d h:i:s')]);
            if ($del)
                {
                    return redirect()->back()->with('success',
 'Cuisine deleted successfully');
                }
                else
                {
                    return redirect()->back()->with('errors',COMMON_ERROR);
                }
        }
}



// Blade File: index. thats is not main file it is only view file ;

// Index.blade.php
<?php

@extends('backEnd.layouts.master')
@section('title','categories')
@section('content')

<div class="page-wrapper">
    <div class="page-breadcrumb">
        <div class="row">
            <div class="col-12 d-flex no-block align-items-center">
                <h4 class="page-title">Content Management </h4>
            </div>
        </div>
    </div>
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <div class="card">
                    <div class="card-body">
                        <h5 class="card-title">Categories</h5>
                        <div class="new_add_btn d-flex justify-content-end 
align-items-center mb-4">
                            <a href="{{ url('admin/category/add') }}"  
class="btn btn-primary mr-1">Add New</a>

                        </div>
                        <div class="table-responsive">
                            <table id="zero_config2"   
class="table table-striped table-bordered">
                                <thead>
                                    <tr>
                                        <th>Name</th>
                                        <th>Image</th>           
                                        <th>Action</th>
                                    </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    @include('backEnd.common.footer')
</div>
@endsection
@section('scripts')
<script>
    $('#zero_config2').DataTable({
        "order": [[ 0, "desc" ]],
        'processing': true,
        'serverSide': true,
        'serverMethod': 'post',
        'ajax':{
            'url': "{{ url('admin/data/categories') }}",
            "error": function(reason) {
                console.log(reason);
            }
        },
        "columns" : [
            { data: 'name' },
            { data: 'image' },          
            { data: 'action', name: 'action', orderable: false, searchable: false}
        ]
    });
</script>
@endsection


form.blade.php

Note: this is main file you can edit and update only one file;


<?php
    if(isset($categorieData)){
        $title = 'Edit';
        $form_id = 'CategoryForm';
$image_text = 'Update Image';
        $action  =  url('/admin/category/edit/'.$category_id);
    }else{
        $title = 'Add';
        $form_id = 'CategoryForm';
$image_text = 'Update Image';
        $action  =  url('/admin/category/add');
    }
?>


@extends('backEnd.layouts.master')
@section('title',$title.' Content Management')
@section('content')




<div class="page-wrapper">
    <div class="page-breadcrumb">
        <div class="row">
            <div class="col-12 d-flex no-block align-items-center">
                <h4 class="page-title">Content Management</h4>
                <div class="ml-auto text-left">
                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item">
<a href="{{ url('admin/categories') }}">Content</a></li>
                            <li class="breadcrumb-item active" aria-current="page">
{{ $title }} category</li>
                        </ol>
                    </nav>
                </div>
            </div>
        </div>
    </div>
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-12">
                <div class="card">
                    <form class="form-horizontal" name="registration" method="post" 
 action="{{ $action }}"
                        id="user_form" enctype="multipart/form-data">
                        @csrf
                        <div class="card-body">
                            <h4 class="card-title">{{ $title }} Category</h4>
                            <div class="form-group row">
                                <label class="col-sm-3 text-right control-label
 col-form-label">Name:</label>
                                <div class="col-sm-7">
                                    <input type="text" class="form-control" 
placeholder="Name" name="name"
                                        value="{{ isset($categorieData['name'])?
 $categorieData['name']: old('name') }}">
                                </div>
                            </div>
                            <label for="image" class="m-t-10"></label>
                            <?php
                                $image = DefaultImgPath;

                                if(!empty($categorieData['image'])){
                                $image =
 ContentCategoriesImgPath.'/'.$categorieData['image'];
                                }
                            ?>

                            <div class="container-fluid" 
style="padding-left: 270px; padding-bottom: 20px;">
                                <div>
                                    <img src="{{$image}}" id="old_image" 
alt="No image" class="img-fluid" width="15%"
                                        height="10%" accept=".jpg,.png,.gif,.jpeg">
                                </div>
                                <div>
                                    <div class="Upload-img mt-3">
                                        <span class="uploader">
                                            <button type="button" 
                                 class="btn btn-danger">{{ $image_text }}</button>
                                            <input type="file" name="image" 
id="img_upload" class="img_cls">
                                            // <!-- <span class="img_load">
                                            //      <input type="hidden" 
                        name="image" id="img_upload"  class="img_cls">
                                            // </span> -->
                                        </span>
                                    </div>
                                </div>
                            </div>
                        </div>


                        @if($errors->any())
                        <div class="form-group row">
                            <label class="col-sm-3 text-right control-label 
col-form-label"></label>
                            <div class="col-sm-7">
                                <div class="alert alert-danger">
                                    <ul>
                                        @foreach ($errors->all() as $error)
                                        <li>{{ $error }}</li>
                                        @endforeach
                                    </ul>
                                </div>
                            </div>
                        </div>
                        @endif


                        <div class="error">

                        </div>

                        <div class="border-top">
                            <div class="card-body">
                                @csrf()
                                <button type="submit" class="btn btn-primary"
                                    style="float: right; margin-bottom: 20px">
                                        Submit</button>
                            </div>
                        </div>
                </div>
                </form>
            </div>
        </div>
    </div>
</div>
@include('backEnd.common.footer')
</div>
@endsection

?>
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Regex pattern validation in laravel

 Programing Coderfunda     September 07, 2020     No comments   

'name' => ['required', 'regex:^[A-ZÀÂÇÉÈÊËÎÏÔÛÙÜŸÑÆŒa-zàâçéèêëîïôûùüÿñæœ0-9_.,()]+$^']


'name' => ['required', 'regex:/^[A-ZÀÂÇÉÈÊËÎÏÔÛÙÜŸÑÆŒa-zàâçéèêëîïôûùüÿñæœ0-9_.,() ]+$/']


address:{
                minlength:2,
                maxlength:500,
                regex:/^[a-zA-z,-/_=. #]+$/,
            },

protected static $rules = [
'zip_code' => 'required|regex:/\b\d{5}\b/'
];
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Xampp Server Start

 Programing Coderfunda     September 07, 2020     No comments   


sudo /etc/init.d/apache2 stop
sudo /opt/lampp/lampp start
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Regex pattern validation in laravel

 Programing Coderfunda     September 07, 2020     No comments   

'name' => ['required', 'regex:^[A-ZÀÂÇÉÈÊËÎÏÔÛÙÜŸÑÆŒa-zàâçéèêëîïôûùüÿñæœ0-9_.,()]+$^']


'name' => ['required', 'regex:/^[A-ZÀÂÇÉÈÊËÎÏÔÛÙÜŸÑÆŒa-zàâçéèêëîïôûùüÿñæœ0-9_.,() ]+$/']


address:{
                minlength:2,
                maxlength:500,
                regex:/^[a-zA-z,-/_=. #]+$/,
            },

protected static $rules = [
     'zip_code' => 'required|regex:/\b\d{5}\b/'
];
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Xampp Server Start

 Programing Coderfunda     September 07, 2020     No comments   


sudo /etc/init.d/apache2 stop
sudo /opt/lampp/lampp start
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Laravel validate decimal 0-99.99

 Programing Coderfunda     September 07, 2020     No comments   

Laravel validate decimal 0-99.99
The Laravel between validation rule is actually pretty powerful and can handle decimal values as well. So there's no need to use regex just do this:
'required|between:0,99.99'

function rules(){

return [
'field_name'=> array('regex:/^(?:d*.d{1,2}|d+)$/','min:1','max:10')
];
}


Validate decimal numbers in JavaScript - IsNumeric()


// Whitespace strings:
IsNumeric(' ') == true;
IsNumeric('\t\t') == true;
IsNumeric('\n\r') == true;

// Number literals:
IsNumeric(-1) == false;
IsNumeric(0) == false;
IsNumeric(1.1) == false;
IsNumeric(8e5) == false;
Some time ago I had to implement an IsNumeric function, to find out if a variable contained a numeric value, regardless of its type, it could be a String containing a numeric value (I had to consider also exponential notation, etc.), a Number object, virtually anything could be passed to that function, I couldn't make any type assumptions, taking care of type coercion (eg. +true == 1; but true shouldn't be considered as "numeric").

2nd...................

Arrrgh! Don't listen to the regular expression answers. RegEx is icky for this, and I'm not talking just performance. It's so easy to make subtle, impossible to spot mistakes with your regular expression.
If you can't use isNaN(), this should work much better:
function IsNumeric(input)
{
return (input - 0) == input && (''+input).trim().length > 0;
}
Here's how it works:
The (input - 0) expression forces JavaScript to do type coercion on your input value; it must first be interpreted as a number for the subtraction operation. If that conversion to a number fails, the expression will result in NaN. This numeric result is then compared to the original value you passed in. Since the left hand side is now numeric, type coercion is again used. Now that the input from both sides was coerced to the same type from the same original value, you would think they should always be the same (always true). However, there's a special rule that says NaN is never equal to NaN, and so a value that can't be converted to a number (and only values that cannot be converted to numbers) will result in false.
The check on the length is for a special case involving empty strings. Also note that it falls down on your 0x89f test, but that's because in many environments that's an okay way to define a number literal. If you want to catch that specific scenario you could add an additional check. Even better, if that's your reason for not using isNaN() then just wrap your own function around isNaN() that can also do the additional check.





Laravel set between digits in validation

'required|integer|digits_between:1,10'
or
'display_post_count' => 'required|min:1|max:10',
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Get Multipal Array Data Array in Array Laravel

 Programing Coderfunda     September 07, 2020     Laravel     No comments   

Array
(
    [0] => Array
        (
            [id] => 8
            [restaurant_id] => 5
            [category_id] => 1
            [deleted_at] =>
            [created_at] => 2020-08-31T08:40:58.000000Z
            [updated_at] => 2020-08-31T08:40:58.000000Z
            [categorylistdd] => Array
                (
                    [id] => 1
                    [name] => Burger
                    [image] => Burger.svg
                    [banner] =>
                    [deleted_at] =>
                    [created_at] =>
                    [updated_at] =>
                )

        )

    [1] => Array
        (
            [id] => 9
            [restaurant_id] => 5
            [category_id] => 2
            [deleted_at] =>
            [created_at] => 2020-08-31T08:44:40.000000Z
            [updated_at] => 2020-08-31T08:44:40.000000Z
            [categorylistdd] => Array
                (
                    [id] => 2
                    [name] => Desert
                    [image] => Dessert.svg
                    [banner] =>
                    [deleted_at] =>
                    [created_at] =>
                    [updated_at] =>
                )

        )


Answer : $value['categorylistdd']['name'],

you can use Also pluck in laravel 

Note: by use get->()->plucke(' Desert ')->addArray();
You will get all data of Name, Image , banner check top On
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Laravel validate decimal 0-99.99

 Programing Coderfunda     September 07, 2020     No comments   

Laravel validate decimal 0-99.99
The Laravel between validation rule is actually pretty powerful and can handle decimal values as well. So there's no need to use regex just do this:
'required|between:0,99.99'

function rules(){

   return [
   'field_name'=> array('regex:/^(?:d*.d{1,2}|d+)$/','min:1','max:10')
        ]; 
}

Validate decimal numbers in JavaScript - IsNumeric()


// Whitespace strings:
IsNumeric(' ')    == true;
IsNumeric('\t\t') == true;
IsNumeric('\n\r') == true;

// Number literals:
IsNumeric(-1)  == false;
IsNumeric(0)   == false;
IsNumeric(1.1) == false;
IsNumeric(8e5) == false;
Some time ago I had to implement an IsNumeric function, to find out if a variable contained a numeric value, regardless of its type, it could be a String containing a numeric value (I had to consider also exponential notation, etc.), a Number object, virtually anything could be passed to that function, I couldn't make any type assumptions, taking care of type coercion (eg. +true == 1; but true shouldn't be considered as "numeric").

2nd...................

Arrrgh! Don't listen to the regular expression answers. RegEx is icky for this, and I'm not talking just performance. It's so easy to make subtle, impossible to spot mistakes with your regular expression.
If you can't use isNaN(), this should work much better:
function IsNumeric(input)
{
    return (input - 0) == input && (''+input).trim().length > 0;
}
Here's how it works:
The (input - 0) expression forces JavaScript to do type coercion on your input value; it must first be interpreted as a number for the subtraction operation. If that conversion to a number fails, the expression will result in NaN. This numeric result is then compared to the original value you passed in. Since the left hand side is now numeric, type coercion is again used. Now that the input from both sides was coerced to the same type from the same original value, you would think they should always be the same (always true). However, there's a special rule that says NaN is never equal to NaN, and so a value that can't be converted to a number (and only values that cannot be converted to numbers) will result in false.
The check on the length is for a special case involving empty strings. Also note that it falls down on your 0x89f test, but that's because in many environments that's an okay way to define a number literal. If you want to catch that specific scenario you could add an additional check. Even better, if that's your reason for not using isNaN() then just wrap your own function around isNaN() that can also do the additional check.





Laravel set between digits in validation

'required|integer|digits_between:1,10'
or
'display_post_count' => 'required|min:1|max:10',
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Get Multipal Array Data Array in Array Laravel

 Programing Coderfunda     September 07, 2020     Laravel     No comments   

Array
(
    [0] => Array
        (
            [id] => 8
            [restaurant_id] => 5
            [category_id] => 1
            [deleted_at] =>
            [created_at] => 2020-08-31T08:40:58.000000Z
            [updated_at] => 2020-08-31T08:40:58.000000Z
            [categorylistdd] => Array
                (
                    [id] => 1
                    [name] => Burger
                    [image] => Burger.svg
                    [banner] =>
                    [deleted_at] =>
                    [created_at] =>
                    [updated_at] =>
                )

        )

    [1] => Array
        (
            [id] => 9
            [restaurant_id] => 5
            [category_id] => 2
            [deleted_at] =>
            [created_at] => 2020-08-31T08:44:40.000000Z
            [updated_at] => 2020-08-31T08:44:40.000000Z
            [categorylistdd] => Array
                (
                    [id] => 2
                    [name] => Desert
                    [image] => Dessert.svg
                    [banner] =>
                    [deleted_at] =>
                    [created_at] =>
                    [updated_at] =>
                )

        )


Answer : $value['categorylistdd']['name'],

you can use Also pluck in laravel 

Note: by use get->()->plucke(' Desert ')->addArray();
You will get all data of Name, Image , banner check top On
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

03 September, 2020

Laravel: Login and Register forms on the same page

 Programing Coderfunda     September 03, 2020     No comments   

Laravel: Login and Register forms on the same page

July 1, 2019
Quite often, especially in e-shop projects, you can see a page to login or register before finishing the purchase. But Laravel has these two routes as separate login and register pages. So how to merge them together and avoid conflicts?

Notice: at the end of this article, you will find a link to Github project with a simple Laravel checkout process.

This is the pre-checkout page we’re aiming for:

On the surface, it’s pretty easy – just copy/paste all the Blade code from /resources/views/auth/login.blade.php and /resources/views/auth/register.blade.php into one common, let’s say, /resources/views/checkout.blade.php. And that’s true, but that’s only one part of the story.

The problem arises because of the same names of fields.

Login form has this:

<input id="email" type="email"
       class="form-control @error('email') is-invalid @enderror" name="email"
       value="{{ old('email') }}" required autocomplete="email" autofocus>
Register form has this:

<input id="email" type="email"
       class="form-control @error('email') is-invalid @enderror" name="register_email"
       value="{{ old('email') }}" required autocomplete="email">
See the difference? I don’t either. Except for autofocus, which is irrelevant in our case.

And you would think that it’s ok, because those two forms POST to different URLs and perform different actions. But in case of failing validation, you get errors on both forms instead of one. For example, in case of invalid credentials when you login, you see this:


Step 1. Rename the fields in one of the form.
For this example, we will rename the fields in the registration part, adding “register_” prefix to them:

<input id="register_name" type="text"
       class="form-control @error('register_name') is-invalid @enderror" name="register_name"
       value="{{ old('register_name') }}" required autocomplete="name" autofocus>

@error('register_name')
    <span class="invalid-feedback" role="alert">
        <strong>{{ $message }}</strong>
    </span>
@enderror

...

<input id="register_email" type="email"
       class="form-control @error('register_email') is-invalid @enderror" name="register_email"
       value="{{ old('register_email') }}" required autocomplete="email">

@error('register_email')
    <span class="invalid-feedback" role="alert">
        <strong>{{ $message }}</strong>
    </span>
@enderror

...

<input id="register_password" type="password"
       class="form-control @error('register_password') is-invalid @enderror"
       name="register_password"
       required autocomplete="new-password">

@error('register_password')
    <span class="invalid-feedback" role="alert">
        <strong>{{ $message }}</strong>
    </span>
@enderror

...

<input id="password-confirm" type="password" class="form-control"
    name="register_password_confirmation" required autocomplete="new-password">
Step 2. Override validator in RegisterController.
Here’s the method validator() from the original app/Http/Controllers/Auth/RegisterController.php, that comes from the framework itself:

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:8', 'confirmed'],
    ]);
}
So, we need to override that validator with our own, adding some rules to it. In fact, we just need to use the renamed fields from Step 1, and then assign their names properly. Here’s the code:

protected function validator(array $data)
{
    $validator = Validator::make($data, [
        'register_name' => ['required', 'string', 'max:255'],
        'register_email' => ['required', 'string', 'email', 'max:255', 'unique:users,email'],
        'register_password' => ['required', 'string', 'min:8', 'confirmed'],
    ]);
    $validator->setAttributeNames([
        'register_name' => 'name',
        'register_email' => 'email',
        'register_password' => 'password',
    ]);

    return $validator;
}
As you can see, we now use register_xxx fields instead of just xxx, but we also need to make sure they return validation errors with their “original” names, so for that we use less-known setAttributeNames() method. It’s not officially mentioned in documentation, but you see another example of its use in this StackOverflow thread.

And that’s it! Now, we have separate two forms on the same “checkout” page.

Bonus: E-shop Checkout Demo Project
As a part of this article, we actually created a typical checkout process mini-project, which is available on Github for you to see. Homepage contains list of products, you can buy each of them, and then session has your “cart” which you can checkout at any time, by clicking “Checkout” on top.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

Meta

Popular Posts

  • Generate Migrations from an Existing Database With the Migration Generator Package
    Laravel Migration Generator Migration Generator for Laravel is a package by Bennett Treptow to generate migrations from existing database ...
  • Tailwindcss best practices for responsive design
    Tailwind CSS provides powerful utilities for responsive design out of the box. To use it effectively and maintain clean, scalable code, here...
  • Search Through Models with Laravel Searchable
      Laravel Searchable   is a package by   Spatie   to search through models and other sources pragmatically. Using this package, you can get ...
  • Laravel Razorpay Integration | Payment gateway integration Laravel in 30 mins | Laravel Razorpay
    1 Integration of Razorpay with Laravel. In this tutorial, I have taught how to integrate payment gateway with laravel with mini-project. If...
  • Vue.js Render functions
        Vue.js Render functions Vue.js recommends us to use templates to build HTML. Here, we can use the render function as a closer-to-the-co...

Categories

  • Ajax (26)
  • Bootstrap (30)
  • DBMS (42)
  • HTML (12)
  • HTML5 (45)
  • JavaScript (10)
  • Jquery (34)
  • Jquery UI (2)
  • JqueryUI (32)
  • Laravel (1017)
  • Laravel Tutorials (23)
  • Laravel-Question (6)
  • Magento (9)
  • Magento 2 (95)
  • MariaDB (1)
  • MySql Tutorial (2)
  • PHP-Interview-Questions (3)
  • Php Question (13)
  • Python (36)
  • RDBMS (13)
  • SQL Tutorial (79)
  • Vue.js Tutorial (69)
  • Wordpress (150)
  • Wordpress Theme (3)
  • codeigniter (108)
  • oops (4)
  • php (853)

Social Media Links

  • Follow on Twitter
  • Like on Facebook
  • Subscribe on Youtube
  • Follow on Instagram

Pages

  • Home
  • Contact Us
  • Privacy Policy
  • About us

Blog Archive

  • ▼  2026 (3)
    • ▼  07/26 - 08/02 (2)
      • A stormwater pond in Calgary appears filled with P...
      • Inside Kriti Sanon's duplex sea-facing penthouse w...
    • ►  06/28 - 07/05 (1)
  • ►  2025 (4)
    • ►  07/06 - 07/13 (2)
    • ►  06/29 - 07/06 (2)
  • ►  2024 (486)
    • ►  09/15 - 09/22 (30)
    • ►  09/08 - 09/15 (35)
    • ►  09/01 - 09/08 (35)
    • ►  08/11 - 08/18 (2)
    • ►  08/04 - 08/11 (33)
    • ►  07/28 - 08/04 (30)
    • ►  07/07 - 07/14 (11)
    • ►  06/30 - 07/07 (35)
    • ►  06/23 - 06/30 (5)
    • ►  06/02 - 06/09 (31)
    • ►  05/26 - 06/02 (20)
    • ►  05/05 - 05/12 (29)
    • ►  04/28 - 05/05 (26)
    • ►  04/07 - 04/14 (10)
    • ►  03/31 - 04/07 (34)
    • ►  03/24 - 03/31 (10)
    • ►  03/03 - 03/10 (35)
    • ►  02/25 - 03/03 (15)
    • ►  02/04 - 02/11 (22)
    • ►  01/28 - 02/04 (30)
    • ►  01/07 - 01/14 (8)
  • ►  2023 (484)
    • ►  12/31 - 01/07 (35)
    • ►  12/24 - 12/31 (10)
    • ►  12/03 - 12/10 (33)
    • ►  11/26 - 12/03 (20)
    • ►  11/05 - 11/12 (35)
    • ►  10/29 - 11/05 (20)
    • ►  10/22 - 10/29 (9)
    • ►  10/15 - 10/22 (7)
    • ►  10/08 - 10/15 (9)
    • ►  10/01 - 10/08 (10)
    • ►  09/24 - 10/01 (9)
    • ►  09/17 - 09/24 (9)
    • ►  09/10 - 09/17 (7)
    • ►  09/03 - 09/10 (9)
    • ►  08/27 - 09/03 (9)
    • ►  08/20 - 08/27 (8)
    • ►  08/13 - 08/20 (8)
    • ►  08/06 - 08/13 (8)
    • ►  07/30 - 08/06 (8)
    • ►  07/23 - 07/30 (7)
    • ►  07/16 - 07/23 (8)
    • ►  07/09 - 07/16 (7)
    • ►  07/02 - 07/09 (8)
    • ►  06/25 - 07/02 (7)
    • ►  06/18 - 06/25 (7)
    • ►  06/11 - 06/18 (7)
    • ►  06/04 - 06/11 (11)
    • ►  05/28 - 06/04 (7)
    • ►  05/21 - 05/28 (8)
    • ►  05/14 - 05/21 (11)
    • ►  05/07 - 05/14 (7)
    • ►  04/30 - 05/07 (7)
    • ►  04/23 - 04/30 (8)
    • ►  04/16 - 04/23 (9)
    • ►  04/09 - 04/16 (7)
    • ►  04/02 - 04/09 (4)
    • ►  03/26 - 04/02 (21)
    • ►  03/19 - 03/26 (2)
    • ►  03/12 - 03/19 (9)
    • ►  03/05 - 03/12 (26)
    • ►  02/26 - 03/05 (25)
    • ►  01/15 - 01/22 (7)
    • ►  01/08 - 01/15 (1)
  • ►  2022 (1037)
    • ►  12/11 - 12/18 (13)
    • ►  12/04 - 12/11 (1)
    • ►  11/27 - 12/04 (40)
    • ►  11/06 - 11/13 (1)
    • ►  10/16 - 10/23 (13)
    • ►  09/04 - 09/11 (5)
    • ►  08/21 - 08/28 (24)
    • ►  08/14 - 08/21 (24)
    • ►  07/03 - 07/10 (9)
    • ►  06/19 - 06/26 (3)
    • ►  05/29 - 06/05 (3)
    • ►  05/22 - 05/29 (3)
    • ►  05/15 - 05/22 (109)
    • ►  05/01 - 05/08 (7)
    • ►  04/24 - 05/01 (7)
    • ►  04/17 - 04/24 (64)
    • ►  04/10 - 04/17 (115)
    • ►  04/03 - 04/10 (73)
    • ►  03/27 - 04/03 (77)
    • ►  03/13 - 03/20 (2)
    • ►  03/06 - 03/13 (25)
    • ►  02/27 - 03/06 (18)
    • ►  02/20 - 02/27 (153)
    • ►  02/13 - 02/20 (187)
    • ►  01/30 - 02/06 (45)
    • ►  01/23 - 01/30 (15)
    • ►  01/16 - 01/23 (1)
  • ►  2021 (412)
    • ►  10/24 - 10/31 (2)
    • ►  07/25 - 08/01 (1)
    • ►  07/11 - 07/18 (10)
    • ►  06/13 - 06/20 (29)
    • ►  05/23 - 05/30 (1)
    • ►  05/02 - 05/09 (24)
    • ►  04/25 - 05/02 (24)
    • ►  04/18 - 04/25 (112)
    • ►  04/11 - 04/18 (1)
    • ►  04/04 - 04/11 (6)
    • ►  03/28 - 04/04 (86)
    • ►  03/21 - 03/28 (19)
    • ►  03/14 - 03/21 (2)
    • ►  03/07 - 03/14 (10)
    • ►  02/28 - 03/07 (1)
    • ►  02/21 - 02/28 (29)
    • ►  02/14 - 02/21 (13)
    • ►  02/07 - 02/14 (12)
    • ►  01/31 - 02/07 (6)
    • ►  01/17 - 01/24 (2)
    • ►  01/10 - 01/17 (8)
    • ►  01/03 - 01/10 (14)
  • ►  2020 (376)
    • ►  12/27 - 01/03 (37)
    • ►  12/20 - 12/27 (92)
    • ►  12/13 - 12/20 (29)
    • ►  12/06 - 12/13 (37)
    • ►  11/29 - 12/06 (4)
    • ►  11/15 - 11/22 (14)
    • ►  11/08 - 11/15 (8)
    • ►  11/01 - 11/08 (2)
    • ►  10/18 - 10/25 (14)
    • ►  10/11 - 10/18 (16)
    • ►  10/04 - 10/11 (10)
    • ►  09/20 - 09/27 (10)
    • ►  09/06 - 09/13 (19)
    • ►  08/30 - 09/06 (26)
    • ►  08/23 - 08/30 (4)
    • ►  08/16 - 08/23 (2)
    • ►  07/12 - 07/19 (48)
    • ►  05/17 - 05/24 (2)
    • ►  01/05 - 01/12 (2)
  • ►  2019 (74)
    • ►  07/07 - 07/14 (6)
    • ►  06/16 - 06/23 (6)
    • ►  02/10 - 02/17 (17)
    • ►  01/13 - 01/20 (37)
    • ►  01/06 - 01/13 (8)
  • ►  2018 (376)
    • ►  12/30 - 01/06 (24)
    • ►  12/16 - 12/23 (8)
    • ►  12/09 - 12/16 (98)
    • ►  12/02 - 12/09 (16)
    • ►  11/18 - 11/25 (36)
    • ►  11/04 - 11/11 (18)
    • ►  10/28 - 11/04 (10)
    • ►  10/21 - 10/28 (26)
    • ►  10/14 - 10/21 (52)
    • ►  10/07 - 10/14 (4)
    • ►  09/30 - 10/07 (2)
    • ►  09/23 - 09/30 (68)
    • ►  09/16 - 09/23 (4)
    • ►  09/09 - 09/16 (4)
    • ►  08/26 - 09/02 (6)

Data Publish News

Loading...

Al Jazeera – Breaking News, World News and Video from Al Jazeera

Loading...

Laravel News

Loading...

Copyright © CoderFunda | Powered by Blogger
Design by Coderfunda | Blogger Theme by Coderfunda | Distributed By Coderfunda