Category : php

I want to scrape data from https://www.gumtree.com.au but it’s nothing to show when I print, I used simplehtmldom library here is my code <?php namespace AppHttpControllers; use IlluminateHttpRequest; use simplehtmldomHtmlWeb; include_once ‘../vendor/autoload.php’; class scraperController extends Controller { public function getData(){ // return ‘test 123’; $client = new HtmlWeb(); $html = $client->load(‘https://www.gumtree.com.au’); print_r($html); } } Source: ..

Read more

i am making a simple crud system using laravel.all working fine when i going to edit the records ran into the problem with record is not updated i didn’t get any error. get the message record updated.when i check the table it is not updated.what i tried so far i attached below Controller public function ..

Read more

I am trying to run a python script within my laravel project using Symfony’s process component: https://symfony.com/doc/current/components/process.html My code is within a controller and looks like this: $process = new Process([ ‘python’, ‘–version’ ]); $process->run(); if(!$process->isSuccessful()) { throw new ProcessFailedException($process); } dd($process->getOutput()); The error I get is the following: The command "python –version" failed. Exit ..

Read more

I am trying to create a new contact using Xero oAuth 2.0 and getting this error: [401] Client error: `PUT https://api.xero.com/api.xro/2.0/Contacts?summarizeErrors=true` resulted in a `401 Unauthorized` response: I have got my scopes as: ‘scopes’ => [ ‘openid’, ’email’, ‘profile’, ‘offline_access’, ‘accounting.settings’, ‘accounting.contacts’, ‘accounting.reports.read’, ], I am able to connect to get the message The App ..

Read more

I’ve problem, I’m trying to redirect users when they log in by role to their dashboard using middleware in laravel 6. But I’m stucked can’t figure out where is the problem in this condition. Please help, thanks kindly. Each role has this route web.php Route::group([ ‘as’=>’user.’, ‘prefix’=>’user’, ‘namespace’=>’User’, ‘middleware’=>[‘auth’,’user’]], function(){ Route::get(‘dashboard’, ‘[email protected]’)->name(‘dashboard’); }); Middleware looks ..

Read more

I’m inserting multiple data into the database. There is an error for my column report_by which is SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘report_by’ cannot be null (SQL: insert into ‘complaints’ (‘defect_id’, ‘image’, ‘description’, ‘report_by’) values (1, C:wamp64tmpphp8E2E.tmp, leak, ?)) Inside column report_by should be the id of the user by using Auth. users table ..

Read more

i am getting this error after i press save button in settings menu Error Name: ErrorException (E_WARNING) Creating default object from empty value Following error on line no.s ErrorException …/app/Http/Controllers/SettingController.php226 69 IlluminateFoundationBootstrapHandleExceptions handleError …/app/Http/Controllers/SettingController.php226 61 IlluminateRoutingPipeline IlluminateRouting{closure} …/app/Http/Middleware/IsAdmin.php30 58 IlluminateRoutingPipeline IlluminateRouting{closure} …/app/Http/Middleware/Localization.php21 24 IlluminateRoutingPipeline IlluminateRouting{closure} …/app/Http/Middleware/RedirectIfUpdateAvailable.php25 21 IlluminateRoutingPipeline IlluminateRouting{closure} …/app/Http/Middleware/RedirectToInstallerIfNotInstalled.php22 0 IlluminateFoundationHttpKernel handle …/public/index.php55 Code ..

Read more

I am beginner php developer. I have small problem with my array. I use in my project Laravel 7 I have this code: $items = collect($discount->products->toArray()); It’s result me: IlluminateSupportCollection {#1783 ▼ #items: array:2 [▼ 0 => array:17 [▼ "id" => 1 "product_category_id" => 5 "image_id" => null "vat_type_id" => 1 "name" => "Produkt 1" ..

Read more

In my Register controller – i have the following method to check if a record exists in another table before creating a user: public function getCompanyDetails($id) { $details = Company::where(‘company_id’, $id)->first(); return $details; } protected function create(array $data) { $company_id = $data[‘com_id’]; $company_details = $this->getCompanyDetails($company_id); if($company_details == null) { return redirect()->back()->with(‘warning’, ‘We could not find ..

Read more

I add https://github.com/sajya/server for making json rpc over my laravel 8. I just follow the instructions provided here to test it https://sajya.github.io/docs/ All works for the basic example, But if I add params to the curl string an error is raised an error that i cannot understand: my code: <?php declare(strict_types=1); namespace AppHttpProcedures; use SajyaServerProcedure; ..

Read more

i am new in laravel. my aim was to create and update a couple of tables through migration. and I created a PHP file rating_v1.0.php and place into database/migrations now I run from the root of the project "PHP artisan migrate" but it falls in an error below Migrating: 2019_05_03_000001_create_customer_columns i don’t have migration file ..

Read more