Category : php-7.4

I’m building a semi-polymorphic/recursive tool to define products for a given website. I am breaking the product down into Components (features or options with sub-features and options), OptionLists (lists of options) and option items broken into simple Options (key/value/label/description) and ComponentOptions (options that add more features and options). To handle writing these configurations into a ..

Read more

Context I just finished developing an internal business application using Laravel/Jetstream with Inertia which uses a Model Broadcaster with Ably integrated for desktop notifications. Everything was working perfectly locally so I pushed live this afternoon. I have everything migrated and what appears to be setup properly, with https working. The server is a LEMP droplet ..

Read more

I have been trying to upload a csv file through backend dashboard of my laravel site, but it’s throwing an error , 504 gateway Timeout nginx . (This works perfectly in staging) While looking for the solution, I have updated the following parameters. In php.ini —> post_max_size upload_max_filesize max_execution_time max_input_time In nginx config —> fastcgi_read_timeout ..

Read more

I have a laravel query form using {!! Form::open([‘method’ => ‘GET’]) !!} with different query fields. For example, I have fields like name category price The user fills out the fields as required, however, even if a field is left ”blank” (null) the query parameter appears in the URL e.g sitename.com/products?name=’test’&category=&price= I was wondering if ..

Read more

My small problem is that Laravel does not trigger the update function if I click on my safe button on the edit page. The only thing that happens after clicking save is that the page is reloaded. Here is my small snippet for the code: edit.blade snippet: <form method="POST" action="{{ route(‘t_update’, $transport->id) }}" enctype="multipart/form-data"> @csrf ..

Read more

As the title says, it just stopped working out of sudden. I have a custom guard: config.auth.php ‘guards’ => [ ‘admin’ => [ ‘driver’ => ‘session’, ‘provider’ => ‘admins’, ], ….. ‘providers’ => [ ‘admins’ => [ ‘driver’ => ‘eloquent’, ‘model’ => AppAdmin::class, ], The user (or shall I say admin?) gets authenticated through login ..

Read more

[2021-04-13 17:57:01] production.ERROR: Invalid argument supplied for foreach() {"exception":"[object] (ErrorException(code: 0): Invalid argument supplied for foreach() at /home/nkcpanel/public_html/vendor/symfony/console/Input/ArgvInput.php:243) [stacktrace] #0 /home/nkcpanel/public_html/vendor/symfony/console/Input/ArgvInput.php(243): IlluminateFoundationBootstrapHandleExceptions->handleError(2, ‘Invalid argumen…’, ‘/home/nkcpanel/…’, 243, Array) #1 /home/nkcpanel/public_html/vendor/symfony/console/Application.php(960): SymfonyComponentConsoleInputArgvInput->getFirstArgument() #2 /home/nkcpanel/public_html/vendor/laravel/framework/src/Illuminate/Console/Application.php(84): SymfonyComponentConsoleApplication->getCommandName(Object(SymfonyComponentConsoleInputArgvInput)) #3 /home/nkcpanel/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): IlluminateConsoleApplication->run(Object(SymfonyComponentConsoleInputArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput)) #4 /home/nkcpanel/public_html/artisan(36): IlluminateFoundationConsoleKernel->handle(Object(SymfonyComponentConsoleInputArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput)) #5 {main} "} Sourc..

Read more

I have a class called UserController that has the following function : public function getOrders() { $user = User::findOrFail(auth()->id()); if ($user->hasRole(‘customer’)) { $washOrders = User::join(‘washes as w’, ‘w.customer_id’, ‘=’, ‘users.id’) ->where(‘w.customer_id’, $user->id) ->where(‘w.status’, ‘done’) ->orWhere(‘w.status’, ‘canceled’) ->get([‘w.*’]); $currentWash = Wash::where(‘customer_id’, $user->id)->where(‘status’, ‘requested’)->orWhere(‘status’, ‘doing’)->firstOrFail(); } else{ return response()->json([ ‘message’ => ‘you don’t have a permission for ..

Read more

This is my code, its a public function, apparently this is an error in php 7.4, i am stuck for hours tried a lot of solutions. when i try to access $banner[‘img_name’] it shows me this error. $categories=Category::all(); $size=Category::count(); $uploaded_categories_code=NULL; foreach($categories as $category) { $banner=CategoryBanner::where(‘category_id’,$category[‘id’])->first(); $imageCover=asset("images/categories/covers/".$category[‘img_name’]); $imageBanner=asset("images/categories/banners/".$banner[‘img_name’]); } Sourc..

Read more

This is my code, its a public function, apparently this is an error in php 7.4, i am stuck for hours tried a lot of solutions. when i try to access $banner[‘img_name’] it shows me this error. I have used this syntax before it works in my other controller. $categories=Category::all(); $size=Category::count(); $uploaded_categories_code=NULL; foreach($categories as $category) ..

Read more

Currently building a Laravel application which allows users to generate football (soccer) tournaments – mostly for 5-7 a side. When creating a tournament, the organiser chooses whether it’s a round-robin or knockouts tournament. They also define how many pitches are available (e.g. 1, 2, 3), how long each match is in minutes and also how ..

Read more

i need help here. I have a problem on register a controller in Laravel 8.0.3. Laravel is throwing an error, because a don’t give a controller complete namespace in Route::get: IlluminateContractsContainerBindingResolutionException Target class [Controller] does not exist. If put complete namespace in the code, they works fine! But in the laravel documentation say i don’t ..

Read more

I have a model class named Case in namespace App. When I try to use it I get: syntax error, unexpected ‘Case’ (T_CASE), expecting identifier (T_STRING) or ‘{‘ Source code, error is on the line with use AppCase: <?php namespace AppHttpControllers; use AppCase; use AppHttpRequestsCaseStoreRequest; use AppHttpRequestsCaseUpdateRequest; use IlluminateHttpRequest; class CaseController extends Controller { /* ..

Read more

In my app.blade.php I used to show a menu from an array : @if ($menu) @foreach ($menu as $submenu) <ul class=”navbar-nav default”> <li class=”sub-menu”> <a href=”{{$submenu[‘link’]}}”>{{$submenu[‘label’]}}</a> @if ($submenu[‘child’]) <ul> @foreach ($submenu[‘child’] as $menu) <li class=”sub-menu”> <a href=”{{$menu[‘link’]}}”>{{$menu[‘label’]}}</a> </li> </ul> @endforeach @endif </li> </ul> @endforeach @endif And I have this array and I worked with it ..

Read more