Category : php-8

Using Laravel, my kernel file has my $routeMiddleware property array as normal. protected $routeMiddleware = [ ‘access’ => AppMiddlewareAllowAccess::class, ‘auth’ => AppMiddlewareAuthenticate::class, … is being changed to this run I run fixer: protected $routeMiddleware = [ ‘access’ => AppMiddlewareAllowAccess::class, ‘auth’ => AppMiddlewareAuthenticate::class, … My fixer rule set looks like so: $config->setRules([ ‘@PSR2’ => true, ‘array_syntax’ ..

Read more

I am working on an old complicated MySql query and I need to write this in Laravel Elequent. SELECT count(relation.id) as amount, IF (relation.type!=2,YEAR(NOW()) – YEAR(if (`relation`.`birthday`=0,null,`relation`.`birthday`)) – (DATE_FORMAT(NOW(), ’00-%m-%d’) < DATE_FORMAT(`relation`.`birthday`, ’00-%m-%d’)),null) as age FROM relation WHERE (`relation`.`stopdate` IS NULL OR `relation`.`stopdate`>’2021-10-04′) GROUP BY age ORDER BY age I have tried different ways. For ..

Read more

i installed composer and have php 8 but after creating first laravel project, am facing this error. Where ever i make project, i face this same error PHP Warning: require(C:Program Filesxampphtdocslaravelmyappp/vendor/autoload.php): Failed to open stream: No such file or directory in C:Program Filesxampphtdocslaravelmyapppartisan on line 18 PHP Fatal error: Uncaught Error: Failed opening required ‘C:Program ..

Read more

A lot of pieces to this so here’s the meat. Code very slightly tweaked for brevity. Extended class: <?php namespace AppHttp; use IlluminateHttpRequest as LaravelRequest; class Request extends LaravelRequest { } Middleware: <?php namespace AppHttpMiddleware; use AppHttpRequest as CustomizedRequest; use Closure; use IlluminateContractsFoundationApplication; use IlluminateHttpRequest; class CustomizeRequest { protected $app; protected $customizedRequest; public function __construct(Application ..

Read more

When a user clicks on the link in my mail it will be forwarded to the signed url I created. The controller method looks like this: public function show(Request $request) { //Remove default sendinblue query parameters foreach (array_keys($request->all()) as $key) { if (! in_array($key, [‘expires’, ‘signature’])) { $request->server->remove($key); } } if (! $request->hasValidSignature()) { return ..

Read more

I’m newbie in Laravel, and follow a free course in Laracast. This is link of my course (episode 11 at 2:49s) "https://laracasts.com/series/laravel-8-from-scratch/episodes/11". Summary of my problem: I’m trying to make my code more declarative with what i wan’t to do (more specific is make a class name: Post, and a method: find() inside this class). ..

Read more

Inheriting variables from the parent scope is not the same as using global variables. Global variables exist in the global scope, which is the same no matter what function is executing. The parent scope of a closure is the function in which the closure was declared (not necessarily the function it was called from). See ..

Read more

I am trying to implement reset password in laravel 8 where i have used Livewire and I am receiving the following error: ErrorException Attempt to read property "name" on null (View: /opt/lampp/htdocs/Qwarqo/resources/views/navigation-menu.blade.php) error line <div class="flex items-center px-4"> @if (LaravelJetstreamJetstream::managesProfilePhotos()) <div class="flex-shrink-0 mr-3"> <img class="h-10 w-10 rounded-full object-cover" src="{{ Auth::user()->profile_photo_url }}" alt="{{ Auth::user()->name }}" /> ..

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 need to create a laravel project that connects to an ODBC database. I installed andreossido/laravel-odbc But It seems to have compatibility issues with PHP 8. I really need to get this going as fast as possible. I followed the guide and got everything configured. I made a test script with a simple fetch and ..

Read more

I have an issue with the time returned from my database, everything is 2 hours in the past. I’ve been troubleshooting this issue for a bit, and checked the following: /etc/php.ini is only ini in use and has date.timezone = Europe/Amsterdam.(also restarted apache) Laravel’s app.php config has ‘timezone’ => ‘Europe/Amsterdam’. I ran config:clear and config:cache. ..

Read more

I’m trying to create a custom collection of a specific type of Data Transfer Objects. I’m using the "spatie/data-transfer-object" package. Here is a test class I’m using to debug this issue that popped up within the last few days. namespace AppDataTransferObjects; ​ use IlluminateSupportCollection; ​ class TestDTOCollection extends Collection { public function __construct($items) { $DTOs ..

Read more

After migrating Laravel 8 app to PHP 8 I was no more able to run composer update or install. I receive the following error: Your requirements could not be resolved to an installable set of packages. Problem 1 – Root composer.json requires nunomaduro/larastan ^0.7.6 -> satisfiable by nunomaduro/larastan[v0.7.6]. – Conclusion: don’t install symfony/process 5.2.x-dev (conflict ..

Read more

is there an alternative? usually in the context with laravel people have to do a lot of return view(‘myfiel’, [ ‘a1’ => $a1, ‘a2’ => $a2]) which is tedious. with compact it is return view(‘myfiel’, compact( ‘a1’, ‘a2′)) personally? compact is less readable. Isn’t there a way to do this "nicer"? Sourc..

Read more