Group by Month and Order the Dates on Laravel Eloquent

 I have the following query $months = \App\DATA::select( DB::raw('sum(order_value) as `sums`'), DB::raw("DATE_FORMAT(created_at,'%M %Y') as months") ) ->where("created_at", ">", \Carbon\Carbon::now()->subMonths(6)) ->groupBy('months') ->get(); that makes a sum of the data for every…

0 Comments

laravel 5.4 error Creating Default Object from Empty Value

Store image path in database. Controller code undervendor\laravel\framework\src\Illuminate\Foundation\Auth\RegistersUsers.php follows: public function register(Request $request) { $this->validator($request->all())->validate(); if($request->hasFile('image')) { $image_name = $request->file('image')->getClientOriginalName(); $image_path = $request->file('image')->store('public'); $user->image = Storage::url($image_name); $user->save(); } event(new Registered($user =…

1 Comment