Use Laravel Debugbar in production for admin

I have a production site (laravel 5.8) which sometime have bug. This bug are not in local. SO i wanted to enable barryvdh debugbar but just for admin in production. I created DebugMiddleware <?php namespace App\Http\Middleware; use App\User; use Closure; use Illuminate\Http\Request; class DebugMiddleware { public function handle($request, Closure $next) // permet d’afficher la debugbar…

How to insert color name with tag name in rtconner/laravel-tagging

I’m using a package named rtconner/laravel-tagging for tags and I want to insert tag colors with tag name, I already modified the table and added a column named color. Before the code was $tag_name = ‘test_tag’; $tags_name = \App\Task::with(‘tagged’)->first(); $tags_name->tag($tag_name); Now I want to do this $tag_name = ‘test_tag’; $color=’red’; $tags_name = \App\Task::with(‘tagged’)->first(); $tags_name->tag($tag_name,$color); It’s…

how to encrypt username and password in laravel login blade

I have created laravel application. I have found an issue when i get burp-suite report.I need to encrypt email and password (vulnerable to cross site request forgery attack) This is my burp-suite report. Cookie: XSRF-TOKEN=””; my_new_session=”” _token=eff13b445f30f3f0527e58625b44c085&email=admin%40test.com&password=123456 login.blade.php <!DOCTYPE html> <html lang=”en” dir=”ltr”> <head> <meta charset=”utf-8″ /> <meta http-equiv=”X-UA-Compatible” content=”IE=edge” /> <meta name=”viewport” content=”width=device-width, initial-scale=1″…

How to catch get parameter and cast it to int in Laravel?

I have the following controller: class CustomerController extends Controller { public function index(int $customerId = 0) : Renderable { dd($customerId); … And I’m requesting it by the following url http://localhost/customers?customerId=123. I would like to catch customerId as int. But It always gives 0 (default value the for method’s signature). Ok, I can do something like:…

Failed to execute unzip -qq facade/flare-client-php creating new Laravel app

I just tried to create a new laravel application using the official installer $ laravel new laravel But it keeps throwing an error on the @php artisan key:generate –ansi command > @php artisan key:generate –ansi PHP Warning: require(/home/user/Sites/laravel/vendor/composer/../facade/flare-client-php/src/helpers.php): failed to open stream: No such file or directory in /home/user/Sites/laravel/vendor/composer/autoload_real.php on line 66 PHP Fatal error:…

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 month in the past 6 months. The problem is that it is outputting the dates in alphabetical order. August 2019 July 2019 June 2019 May…

Laravel: a function is always called on given routes. No middleware is present

I have a Laravel 5.6 route (/media/collection) which looks like this: Route::get(‘/media/collection’, ‘frontend\CollectionController@GetMyCollection’) ->name(‘collection’); The problem is that on every request (to this route ONLY) another function CollectionController->searchProduct() is called, which throws an Exception due to a missing keyword (which is a normal behaviour, searchProduct() is supposed to throw and exception on a missing keyword).…