[Solved] Some fake data coming automatically in webserver databse

Quick workaround: Add a validation on Laravel side (server side validation) with a regex allowing only non-russian characters. Then Post your code with implementation of Google reCAPTCHA, there we’ll find the answer. Which version of Google reCAPTCHA you are using..? 1 solved Some fake data coming automatically in webserver databse

[Solved] I need to get sum of difference of two columns in each row [closed]

You can user Eloquent Builder sum() function. $sum = Sale::select( DB::raw(‘commissioned_total as total – commission’) ) ->sum(‘commissioned_total’); Or you can user Laravel Collection sum() function. $sum = Sale::all()->sum(function($sale) { return $sale->total – $sale->commission; }); You can enhance this method more, Define this commissionedTotal() function on Sale model, and use sum function as Higher Order Message. … Read more

[Solved] How to install Laravel 5.4?

There are multiple ways to install Laravel. One of the simplest ways would be to install through composer with the command: composer create-project –prefer-dist laravel/laravel MyAppName. All of the documentation for installing laravel 5.4 can be found here: https://laravel.com/docs/5.4/installation The new features are covered on laracasts and on the docs. Here is a link to … Read more

[Solved] How to print key value pair in Laravel using foreach loop [closed]

Your code is a mess. here is a cleaner version without using the models (since you did not say if they are in place) Controller Code public function show_friend_request() { $user_id = auth()->user()->id; $senderIds = DB::table(‘friendships’)->where(‘recipient_id’, $user_id)->where(‘status’, ‘pending’)->pluck(‘sender_id’)->toArray(); $activeRequests = DB::table(‘users’) ->whereIn(‘id’, $senderIds) ->get([‘first_name’,’last_name’]); return view(‘pages.friend_request’)->with(‘activeRequest’, $activeRequests); } Blade Code @foreach($activeRequest as $key => $friend) … Read more

[Solved] Need a currency converter in a Laravel website [closed]

There are multiple of packages available : Best one :moneyphp/money Alternatives : Torann/laravel-currency akaunting/money However, you can actually find these and some more on your own. If you do not find these from google search, packagist can be the place to search for a package using keyword like money, currency in this case and you … Read more

[Solved] Method Illuminate\Database\Eloquent\Collection::__toString() must return a string value [closed]

{{ }} is for echo in php First check output as <?php print_r($students); ?> Or @php print_r($students); @endphp And echo output as, for first row value {{ $students[0]->name }} And to print all student name in loop like this @forearch($students as $key=>$student) Name : {{$student->name}} @endforearch solved Method Illuminate\Database\Eloquent\Collection::__toString() must return a string value [closed]

[Solved] Syntax error: unexpected ;

You are missing if in } else ($role_type === ‘User’) { line it should be } else if($role_type === ‘User’) { if (Hash::check($password, $hashedPassword->password)) { $role_type = DB::select(‘select role_type from users where email = ?’, [$email]); if ($role_type === ‘Administrator’) { $request->session()->put(‘success’); return redirect()->route(‘admin’); } else if ($role_type == – ‘Staff’) { $request->session()->put(‘success’); return redirect()->route(‘staff’); … Read more

[Solved] Trying to get property of non-object error on laravel 5.4

Welcome to StackOverflow, yobab77! There’s a wonderful help article on how to ask questions here, that may help you get better assistance in the future. ErrorException Trying to get property of non-object (View: C:\xampp\htdocs\bgcbus\resources\views\usercrud\sendView.blade.php) This error indicates that the bug is coming from your sendView.blade.php view file, which you’ve stated has the following content: TO … Read more