I'm struggling a couple of hours to fix this error but no luck please I need help about this error always says: (Array to string conversion)
Code:
<?php
namespace App\Http\Controllers;
use Validator;
use Illuminate\Http\Request;
use App\Http\Requests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Hash, Auth, URL, Route, Cart, View, Paypal;
use App\Product, App\ProductBenefit, App\Country, App\Currency, App\User, App\City;
class HomeController extends BaseController {
public function postCheckoutStepPayment(Request $request){
if(!is_null($request->input('ship_to_diff_address'))){
$validate = Validator::make($request->all(), User::$rules);
if($validate->fails()) { //<- problem this part
return 'failed';
}
}
}
}
User.php
public static $rules = array(
'diff_firstname' => 'required',
'diff_lastname' => 'required',
'diff_phone' => 'required',
'diff_countries' => 'required',
'diff_city' => 'required',
'diff_state' => 'required',
'diff_address' => 'required',
);
add
use Redirect
at the top, andAdd this class in you controller
And Try this code in blade file.
It appears that the value for locale in your config/app.php is an array, whereas the function loadPath in vendor/laravel/framework/src/Illuminate/Translation/FileLoader.php expects it to be a string. So I suggest you to set it's value to either 'en' or 'sv' in the config file and then later change it programmatically in your code as required.