need help in this code
`,delete” onclick=”show_number(‘comment_author; ?>’,”);”>Show Number
comment_author; ?>” id=”” style=”display:none;” class=”team-infoauth”>comment_author; ?>`
Blancer.com Tutorials and projects
Freelance Projects, Design and Programming Tutorials
Category Added in a WPeMatico Campaign
need help in this code
`,delete” onclick=”show_number(‘comment_author; ?>’,”);”>Show Number
comment_author; ?>” id=”” style=”display:none;” class=”team-infoauth”>comment_author; ?>`
I’m trying to create new laravel project, but it says the following when I run laravel new laragigs
Creating a "laravel/laravel" project at "./laragigs"
Installing laravel/laravel (v9.5.2)
- Installing laravel/laravel (v9.5.2): Extracting archive
Created project in C:UsersOmistajaDesktop/laragigs
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/framework[v9.36.4, ..., v9.51.0] require league/flysystem ^3.8.0 -> satisfiable by league/flysystem[3.8.0, ..., 3.12.2].
- laravel/framework[v9.19.0, ..., v9.36.3] require league/flysystem ^3.0.16 -> satisfiable by league/flysystem[3.0.16, ..., 3.12.2].
- league/flysystem[3.0.16, ..., 3.12.2] require league/mime-type-detection ^1.0.0 -> satisfiable by league/mime-type-detection[1.0.0, ..., 1.11.0].
- league/mime-type-detection[1.0.0, ..., 1.3.0] require php ^7.2 -> your php version (8.2.2) does not satisfy that requirement.
- league/mime-type-detection[1.4.0, ..., 1.11.0] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
- Root composer.json requires laravel/framework ^9.19 -> satisfiable by laravel/framework[v9.19.0, ..., v9.51.0].
To enable extensions, verify that they are enabled in your .ini files:
- C:Program Filesphpphp-8.2.2-nts-Win32-vs16-x86php.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-fileinfo` to temporarily ignore these required extensions.
PS C:UsersOmistajaDesktop>
What hould I do?
I have a registered service where I inject the content of a json as argument (see followed configuration, AppServiceAuthenticator service)
parameters:
env(LDAP_CONFIG_FILE): '../auth.json'
services:
_defaults:
autowire: true
autoconfigure: true
App:
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'
AppServiceAuthenticator:
arguments:
$config: '%env(json:file:resolve:LDAP_CONFIG_FILE)%'
$environment: '%env(APP_ENV)%'
When I try to inject this service in a controller, this works fine as expected. But when I inject the service into a command I get this error :
> php bin/console app:execute
[WARNING] Some commands could not be registered:
In EnvVarProcessor.php line 136:
File "../auth.json" not found (resolved from "resolve:LDAP_CONFIG_FILE").
Command "app:execute" is not defined.
And if I replace env(LDAP_CONFIG_FILE) by auth.json it work in a command but not in a controller anymore.
How can I configure to make it work in both commands and controllers ?
Edit: I found a temporary fix with the default processor but I really want a clean solution.
enter image description hereProblem 1
– phpunit/phpunit[9.5.0, …, 9.5.28] require ext-dom * -> it is missing from your system. Install or enable PHP’s dom extension.
– Root composer.json requires phpunit/phpunit ~9.5.0 -> satisfiable by phpunit/phpunit[9.5.0, …, 9.5.28].
text
I have tried running run Composer with --ignore-platform-req=ext-dom but returns the same error.
I have a webpage that I am using for redirecting users on Page Load it first updates the record in my table Ex. visited for users and after that, I redirect the user to another page.
Everything is working great but somehow I noticed that lots of users are visiting the web page but I can’t track them on Google Analytics & after doing research I found that this is happening because of SMS link preview features.
Due to that, the preview appears on mobile but the user doesn’t click on SMS and the table got updated as visited for that user.
Can anyone please help me to prevent the table update from SMS preview? Thanks in advance.
Please don’t judge I just need help with this.
I have this array values from the database
# amount monthly interest rate
[0] 10,000 500 10%
[1] 400,000 12,000 5%
I want to have a recursive deduction of these arrays until data is zero, and then if the first amount of the array is zero(0) the deduction will add to the next data, until all amount will be zero (0).
Sample Calculation and my code
$data = json_decode($debtsData, true);
$continue = true;
while($continue) {
$continue = max(array_column($data, 'amount')) > 0;
for($i=0; $i<count($data); ++$i) {
$totalInterest = $data[$i]['interest_rate'] / 100;
$periods = 12;
$monthly = $data[$i]['monthly'];
$_new_balance = !isset($data[$i]['done']) ? max($data[$i]['amount'], 0) : '';
$interestPayment = ($totalInterest / $periods ) * $_new_balance;
if($data[$i]['amount'] <= 0 && !isset($data[$i]['done'])) {
$data[$i]['done'] = true;
if(isset($data[$i+1])) {
$data[$i+1]['monthly'] += $data[$i]['monthly'];
}
}
echo !isset($data[$i]['done']) ? '$'.number_format(max($data[$i]['amount'], 0),2) : '';
echo !isset($data[$i]['done']) ? '$'.number_format($data[$i]['monthly'],2) : '';
echo !isset($data[$i]['done']) ? '$'.number_format($interestPayment,2).' ' : '';
$data[$i]['amount'] -= $data[$i]['monthly'] - $interestPayment ;
}
}
My Output is Below
[0] [1]
Beginning - Monthly - Interest Beginning - Monthly - Interest
10,000 - 500 - 83.33 400,000 - 12,000 - 1,666.67
9,583.33 - 500 - 79.86 389,666.67 - 12,000 - 1,623.61
9,163.19 - 500 - 76.36 379,290.28 - 12,000 - 1,580.38
8,739.55 - 500 - 72.83 368,870.65 - 12,000 - 1,536.96
... ... ... ... ... ...
480.78 - 500 - 4.00 162,438.96 - 12,500 - 676.83
0 0 0 0 150,615.79 - 12,500 - 627.56
0 0 0 0 138,743.35 - 12,500 - 578.10
... ... ... ... ... ...
0 0 0 0 0 0 0
What I was needed is that if the first data array has a remaining monthly (e.g above is 500) and it only deducted from the amount 484.78 the remaining should be deducted as well on the second data of the array. And I also confused on how to do it if the first array is much bigger than the second data. If it is vice versa and the second array is already zero(0) the monthly should be added on the first data of the array.
im still new to this laravel framework,so i was having this issue where i’m unable to update column “updated_at” which are automatically created by laravel migration. i want to change the value to the current time when i press a button. i have tried multiple ways from similiar questions but it doesn’t seem to work, like : using ‘->update()’,’->save()’,or ‘->touch()’.
syntax to update in Controller
$check = DB::table('queueTable')->where('category',$catName2)->where('status','Active')->where('skipped','0')->whereDate('created_at','=',now())->orderBy('queue','ASC')->limit(1);
$counter = DB::table('queueTable')->where('category',$catName2)->where('status','Inactive')->whereDate('created_at','=',now())->count();
DB::table('CurrentQueue')->where('id', 2)->update(['DoneQueue' => $counter+1]);
$check->update(['status' => 'Inactive']);
$check->update(['updated_at' => now()->format('Y-m-d H:i:s')]);
my migration
Schema::create('queueTable', function (Blueprint $table) {
$table->id();
$table->string('category');
$table->integer('queue')->default('0');
$table->string('status');
$table->integer('skipped')->default('0');
$table->timestamps();
});
it’d be much appreciated if someone could kindly explain where i’m going wrong.
Thanks in advance.
i want to update the value of “updated_at” to current time when i press a button
I use axios in react code and laravel in backend and when I send request to get all data from table with axios code and index methode in controller in laravel I get status equal = 200 and in data I get code exist in page.blade.php:
{data: ‘<!DOCTYPE html>n<html >n <head>n <meta c…n n n </body>n</html>nnn’, status: 200, statusText: ‘OK’, headers: {…}, config: {…}, …}
config: {transitional: {…}, transformRequest: Array(1), transformResponse: Array(1), timeout: 0, adapter: ƒ, …}
data: “<!DOCTYPE html>n<html >n <head>n <meta charset=”utf-8″>n <meta name=”viewport” content=”width=device-width, initial-scale=1″>n <link …”
headers: {cache-control: ‘no-cache, private’, connection: ‘close’, content-type: ‘text/html; charset=UTF-8’, date: ‘Thu, 09 Feb 2023 10:09:00 GMT, Thu, 09 Feb 2023 10:09:00 GMT’, host: ‘localhost:8000’, …}
request: XMLHttpRequest {onreadystatechange: null, readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, …}
status: 200
statusText: “OK”
[[Prototype]]: Object
mport React, { useState } from "react";
import { Link } from "react-router-dom";
import axios from "axios";
import './login.css'
export default function Login(){
const [account,setAccount]=useState({
mail:"",
password:"",
surname:"",
name:""
})
e.preventDefault()
const res =await axios.get("/login").then((result)=>{
console.log(result)
})
console.log(res)
}
return(
<div className="containerGlobal">
<div className="containerLogin">
<h3 className="titleLogin">Tractafric CFC</h3>
<form onSubmit={(e)=>checkAccount(e)}>
<div className="input-group mb-3">
<span className="input-group-text" id="basic-addon1">@</span>
<input type="text" className="form-control" placeholder="Enter your Email" name="email" value={account.mail} onChange={(e)=>setAccount({...account,mail:e.target.value})}/>
</div>
<div className="input-group mb-3">
<span className="input-group-text" id="basic-addon1">**</span>
<input type="password" className="form-control" placeholder="Enter your Password" name="password" value={account.password} onChange={(e)=>setAccount({...account,password:e.target.value})}/>
</div>
<div className="input-group mb-3">
<span className="input-group-text" id="basic-addon1">@</span>
<input type="text" className="form-control" placeholder="Enter your Email" name="name" value={account.name} onChange={(e)=>setAccount({...account,name:e.target.value})}/>
</div>
<div className="input-group mb-3">
<span className="input-group-text" id="basic-addon1">**</span>
<input type="text" className="form-control" placeholder="Enter your Password" name="surname" value={account.surname} onChange={(e)=>setAccount({...account,surname:e.target.value})}/>
</div>
<div className="containerBtnLogin">
<button className="loginBtn" type="submit" ><i className="fa-solid fa-right-to-bracket"></i> Login </button>
<button className="loginBtn" onClick={(e)=>getAll(e)}><i className="fa-solid fa-right-to-bracket"></i> Load </button>
<Link to="/">Reset password</Link>
</div>
</form>
</div>
</div>
);
}
this is react code
and in controller
public function index()
{
$handlers=Handler::find(2);
return response()->json(['status'=> 200,'handlers'=>$handlers]);
}
I use automapper component (https://jane.readthedocs.io/en/latest/components/AutoMapper.html)
My source can have array properties with keys and values not known in advance. In the example below for example the title of a document in several languages ['fr' => 'Mon titre', 'en' => 'My title']; Is it possible to set dynamic properties to the target (target is an array) as
$target[title_fr] => Mon titre; $target[title_en] => My title;
I was wondering if we could write something like below (it doesn’t work of course) with this type of library:
class SolrDocumentMapperConfiguration implements MapperConfigurationInterface
{
public function getSource(): string
{
return Content::class;
}
public function getTarget(): string
{
return 'array';
}
/**
* @param MapperMetadata $metadata
*/
public function process(MapperGeneratorMetadataInterface $metadata): void
{
$metadata->forMember('rank', static fn (Content $content) => $content->getRank());
$metadata->forMember('title_'.$keyLang, fn (Content $content) {
foreach ($content->getTitles() as $keyLang => $titleLang)
return $titleLang;
}
}
}
Thanks in advance for any help.
index.php ->
<?php
#require_once("./resources/CharactersCreator.php");
#include __DIR__.'/resources/CharactersCreator.php';
require_once("vendor/autoload.php");
/* use Dbdb;
use ControllersCharactersController; */
use ResourcesCharactersCreator;
$peticion = new CharactersCreator;
$peticion->mirror();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>home</title>
</head>
<body>
<h1>List of Characters</h1>
<?php foreach ($results as $res): ?>
<div class="card">
<h3>name: <?= $res["name"] ?> </h3>
<img src=<?= $res["image"] ?> alt="nada">
<h3>status: <?= $res["status"] ?> </h3>
<h3>species: <?= $res["species"] ?> </h3>
<button onclick=<?=header('location:http://127.0.0.1/prueba/RyM-Crud/index.php?id='."{$res["id"]}".'')?>></button>
</div>
<?php endforeach; ?>
</body>
</html>
Resouerces/CharactersCreator.php
<?php
#require_once("../controllers/CharactersController.php");
namespace Resources ;
use ControllersCharactersController;
class CharactersCreator {
static $url = "https://rickandmortyapi.com/api/character";
public function create($url){
try {
#$data = json_decode(file_get_contents("https://api.mercadolibre.com/users/226384143/"),true);
$data = json_decode(file_get_contents($url),true);
#print_r($data["results"]);
foreach($data["results"] as $characters){
$carga = new CharactersController;
$carga->store([
#"id" => $characters["id"],
"name" => $characters["name"],
"status" => $characters["status"],
"species" => $characters["species"],
"type" => $characters["type"],
"gender" => $characters["gender"],
"origin" => $characters["origin"]["name"],
"location" => $characters["location"]["name"],
"image" => $characters["image"],
"episode" => $characters["episode"][0],
"url" => $characters["url"],
"created" => $characters["created"]
]);
}
#echo "done";
} catch (Throwable $e) {
echo "el error es: ". $e->getMessage() . "n error linea:". $e->getLine()."n" ;
#echo $e->getTrace();
}
}
#create($url);
public function mirror(){
try {
$peticion = new CharactersController;
$peticion->index();
} catch (Throwable $e) {
echo "el error es: ". $e->getMessage() . "n error linea:". $e->getLine()."n" ;
}
}
public function idSearch($id){
try {
$peticion = new CharactersController;
$peticion->store($id);
} catch (Throwable $e) {
echo "el error es: ". $e->getMessage() . "n error linea:". $e->getLine()."n" ;
}
}
}
composer Json ->
{
"name": "informatica/ry-m-crud",
"description": "development test",
"license": "MIT",
"authors": [
{
"name": "Agustin"
}
],
"require": {
"nickbeen/rick-and-morty-api-php": "^1.0",
"guzzlehttp/guzzle": "^7.5",
"myclabs/php-enum": "^1.8",
"netresearch/jsonmapper": "^4.1"
},
"psr-4": {
"Db\": "db/",
"Controllers\":"controllers/",
"Resources":"resources/"
}
}
I want to instantiate my CharacterCreator class and execute the mirror() function, in order to pass its results as part of the foreach,And when re-rendering the index.php it shows me something like a card for each of the positions of the array.
i tried this code to create custom tab and input now i am looking how to save and display the input text on order details page. i want to add text in new custom tab and show that text in order details page
add_filter('woocommerce_product_data_tabs', 'custom_tab');
function custom_tab($tabs) {
$tabs['ppwp_woo'] = array(
'label' => 'Custom Link',
'target' => 'ppwp_woo_options',
'priority' => 65,
);
return $tabs;
}
add_action( 'woocommerce_product_data_panels' ,'custom_tab_content' );
function custom_tab_content() {
global $woocommerce, $post;
?>
<div id="ppwp_woo_options" class="panel woocommerce_options_panel">
<?php
woocommerce_wp_text_input(
array(
'id' => '_custom_link',
'label' => __( 'link', 'woocommerce' ),
'desc_tip' => 'true',
'description' => __( 'Insert any text that you want to include in the order product details.', 'woocommerce' ),
)
);
?>
</div>
<?php
}
add_action( 'woocommerce_process_product_meta', 'save_options' );
function save_options($product_id)
{
$keys = array(
'_custom_link',
);
foreach ($keys as $key) {
if (isset($_POST[$key])) {
update_post_meta($product_id, $key, $_POST[$key]);
}
}
}
Im looking to accept @ in the URL to pass information and parse it in the other site, but havent got it.
Example:
I have this URL
https://completeurl.com/@username
I want only the username at the end
I only manage doing something like this
https://completeurl.com/testusername.php/@something
the result in fact it is: something
but I want to be a clean URL
is it possible?
I am working with php and right now i have following variable for “datetime” And i want to display data in “month/days/hours/minutes/seconds” ago in php,How can i do this ?
$date="2022-10-20 05:42:11";
I’m currently looking into selecting a single domain on the Adsense API to see if the domain is currently available in Adsense. Selecting all
domains goes well, but it seems a bit cumbersome to loop all properties. So I’m looking for a single select
Current code:
# Setup client
$client = new Google_Client();
$client->setAccessToken(GOOGLE_ACCESS_TOKEN);
# Setup api
$adsense = new GoogleServiceAdsense($client);
# Set Scope to adsense
$client->setScopes(['https://www.googleapis.com/auth/adsense']);
# list account sites
$ads = $adsense->accounts_sites->listAccountsSites("accounts/pub-xxxxxxxxxxxxxxxx");
#loop through the domains and check if in array
foreach ($ads as $a) {
$ad_sites[] = $a['domain'];
}
# Result:
$in_adsense = in_array($domain, $ad_sites)
What looks promising is the current doc by Google:
https://developers.google.com/adsense/management/reference/rest/v2/accounts.sites/get
And the corresponding get method: https://developers.google.com/adsense/management/reference/rest/v2/accounts.sites/get
I however can’t seem to find the right syntax to select a single domain on the Google SDK. Any help would be appriciated.
I have a pdf that allows users to type in the data fields
I use pdftk to pre-populate this pdf with values from the database and this works perfectly
I then need to draw lines on the pdf to “strike through” the empty fields (so the ultimate recipient then knows that the particular section on the pdf if not required and not that the data is missing accidentally)
I use pdftk to populate the pdf
I then use the fpdf library to draw the lines on the appropriate pages/locations
The problem I have is that drawing the lines on the pdf flattens the output pdf, which means that the pdf cannot then be edited
I need the fields in the pdf to be editable
For what it is worth, the code snippet that draws the lines and saves the output is here (but as I say, the code works, it’s just that the output command is flattening the pdf so I can then later on edit the values on the pdf)
$sourceFile="test.pdf"
$outputFile="output.pdf";
$pdf = new Fpdi('P', 'mm', 'A4');
$pageCount = $pdf->setSourceFile($sourceFile);
for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++)
{
$templateId = $pdf->importPage($pageNo);
$pdf->AddPage();
$pdf->useTemplate($templateId);
//now we add custom colours and lines
$pdf->SetDrawColor(0, 0, 0); // red
$pdf->SetLineWidth(3);
$pdf->Line(10,20,30,40);
}
}
$pdf->Output($outputFile,'F');
Hope this makes sense and that someone can help me, please 🙂