PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, January 13, 2022

[FIXED] Error "Trying to access array offset on value of type null" laravel 5.8.26 Php 7.4.2

 January 13, 2022     laravel, laravel-5, php     No comments   

Issue

I use below function for insert/create new user from admin panel:

public function store(Request $request)
{
    $this->validate($request, [
        'name' => 'required',
        'email' => 'required|email|unique:users,email',
        'password' => 'required|same:confirm-password'
    ]);


    $input = $request->all();
    $input['password'] = Hash::make($input['password']);


    User::create($input);

    return redirect()->route('admin.pages.users.index')
        ->with('success','User created successfully');
}

when I submit I get error as below :-

Trying to access array offset on value of type null

EDIT: I found my problem. my problem is email validation rule. when i remove email validation insert data is true.

enter image description here

How do can i fix this error !


Solution

Change Your Php version in Composer.json to 7.4.1 and run

composer update

This works for me



Answered By - Ahmed Hegazy
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing