Append array Request::all()

Submitted by mlselegant - 8 years ago

Append array in $request::all() while saving data in laravel 5.2

public function store(Request $request){
        $arr = ['user'=> 'Elegant'];    // ['key' => 'value']
        $data = array_merge($request::all(), $arr);
        
        Profile::create($data); // table name = Profile
        return back();
}