Category : illuminate

I’m trying to make a post http request using IlluminateSupportFacadesHttp. My request : $response = Http::post( $this->api.’/auth’, [ ‘auth’ => [ ‘username’ => $this->username, ‘password’ => $this->password ] ] )->json(‘response’); While api,username and password are set in a __construct method. This request is working well in postman. But when I run it on php server ..

Read more

I use Eloquent PHP as ORM and implement query builder for my web applications. Usually, it works when the code looks like this. $builder = Area::query()->limit(30); if ($subDistrictCode = $request->getParam(‘sub_district_code’)) { $builder->where(‘sub_district_code’, $subDistrictCode); } if ($districtCode = $request->getParam(‘district_code’)) { $builder->where(‘district_code’, $districtCode); } $areasCount = $builder->count(); if ($limit = $request->getParam(‘length’)) { $builder->limit($limit); } if ($offset = ..

Read more

when i run php artisan route:list i can find the route GET|HEAD | accounting/sales but whenever i send the request using postman i get the same error SymfonyComponentHttpKernelExceptionMethodNotAllowedHttpException: The GET method is not supported for this route. Supported methods: POST. in file C:xampphtdocsprojectscontrollercontrollerapivendorlaravelframeworksrcIlluminateRoutingAbstractRouteCollection.php on line 117 and when i try to to change the request ..

Read more

I am trying to update Larvel to v7.0 using composer update, but I’m getting that Laravel and immulinate view cannot co-exist. I’ve tried various version combinations, yet get the same error. How do I handle this? I’m running on CentOS 8, with PHP 7.2.24. This is the result of my update: – Root composer.json requires ..

Read more

i can count files in the folder with this : IlluminateFilesystemFilesystemFile::files($path) then i can count all files in all subfolders (with specific storage) foreach ($directories as $directory) { $path = Storage::disk($this->disk)->path($directory); $files = IlluminateFilesystemFilesystemFile::files($path); if ($files) { $count += count($files); } } } i can count all files in this folder How can i count ..

Read more

I would like to override ‘subject’ method in IlluminateMailMailable.php class in such way, that every email that is sent out of the application has a certain prefix ‘[Something]’ in front of mail subject. My first approach was to create CustomMailable.php that extends IlluminateMailMailable.php , customize subject method, edit stub needed for artisan make:email command to ..

Read more

I need to change the request parameter i.e. email, and then attempt login with the new email. What I am trying: $user_handle = $request->email; $gook = Gookarma::where(‘handle’, ‘=’, $user_handle)->firstOrFail(); $acc = Account::find($gook->karmable_id); $request->email = $acc->email; if ($this->attemptLogin($request)) { return $this->sendLoginResponse($request); } But it doesn’t update the request, and login attempt goes with the previous email ..

Read more

I need to remove the pagination and leave everything on one page, but this way I’m doing it only generates BUG. I wonder why the snippet of the commented code doesn’t work to remove the pagination. whereHas(‘sizes’, function($query) use($minParam, $maxParam) { if($minParam && $maxParam) { $query->whereBetween(‘max_capacity’, [$minParam, $maxParam]); } elseif($minParam) { $query->where(‘max_capacity’, ‘>=’, $minParam); } ..

Read more