Laravel Redirect To Another URL / Web Page - HTTP Laravel Redirects

Laravel Validation Unique Soft Delete Example

Today, We want to share with you Laravel Validation Unique Soft Delete Example.In this post we will show you laravel validation exists soft delete, hear for Laravel 5 Validation Unique With Soft Delete Example we will give you demo and example for implement.In this post, we will learn about laravel validation unique soft delete with an example.

Laravel Validation Unique Soft Delete Example

There are the Following The simple About Laravel Validation Unique Soft Delete Example Full Information With Example and source code.

  Get the full URL in PHP

As I will cover this Post with live Working example to develop Laravel Validation Unique Soft Delete
, so the some major files and Directory structures for this example is following below.

  • laravel validation unique soft delete
  • unique validation with soft delete

On Create Method:

laravel validation unique soft delete

public function store(Request $request)
{
//laravel soft delete unique validation
    $request->validate([
        'name'=>'required|unique:form_types,name,NULL,id,deleted_at,NULL',
    ]);
    // Write your source Code here
}

On Update Method:

unique validation with soft delete

public function update(Request $request, $id)
{
//laravel validation exists soft delete
    $request->validate([
        'name'=>'required|unique:form_types,name,'.$id.',id,deleted_at,NULL',
    ]);
    // Write your source Code here
}

Laravel Validation Unique Soft Delete

validation.php

public function rules()
{
    $member = Member::find($this->members);
 
    switch($this->method())
    {
        case 'GET':
        case 'DELETE':
        {
            return [];
        }
        case 'POST':
        {
            return [
                'member.name.first' => 'required',
                'member.name.last'  => 'required',
                'member.email'      => 'required|email|unique:members,email',
                'member.password'   => 'required|confirmed',
            ];
        }
        case 'PUT':
        case 'PATCH':
        {
            return [
                'member.name.first' => 'required',
                'member.name.last'  => 'required',
                'member.email'      => 'required|email|unique:members,email,'.$member->id,
                'member.password'   => 'required|confirmed',
            ];
        }
        default:break;
    }
}

Angular 6 CRUD Operations Application Tutorials

Read :

  WooCommerce Get Product ID

Summary

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

I hope you get an idea about Laravel Validation Unique Soft Delete 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.

Leave a Reply

avatar
  Subscribe  
Notify of