mercredi 1 décembre 2021

Can anybody tell the if file doesn't exists it redirect to webinstaller

Can anybody tell the if file doesn't exists it redirect to webinstall. How to go the redirection to webinstaller url in laravel when i deleting the .env file is 500 error



via Chebli Mohamed

convert a sql query to php laravel query

convert a sql query to php laravel query .

DB::select("SELECT distinct q_id,theme, ownerID, p_id, q_type, screen, leadin, scenario, option_text, o_media, correct, display_method, score_method, q_media, q_media_width, q_media_height, marks_correct, marks_incorrect, display_pos, STATUS, correct_fback, feedback_right,last_edited, locked, settings FROM (papers, questions) LEFT JOIN options ON questions.q_id = options.o_id WHERE paper=$id AND papers.question=questions.q_id GROUP BY(q_id) ORDER BY screen ASC");



via Chebli Mohamed

lundi 29 novembre 2021

Is it possible to copy file directly from sign url fetch from amazon S3?

I have fetch url from AWS Bucket like this: https://{bucket_path}/iportalDocuments/99/aid.jpeg?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIARYDJGMIUARGRF2Y3%2F20211130%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20211130T065101Z&X-Amz-SignedHeaders=host&X-Amz-Expires=1200&X-Amz-Signature=f2e7ccba4e7d42238d03c311cc0fb9768fb47b52891d8cbe86def3f4f827762e

Is it possible to copy file from url using spatie library. Thank you in advance..



via Chebli Mohamed

Calling the failed function: 'should not be called statically' in laravel 5.4

I use version laravel 5.4

In Helpers/Helper.php

public function test()
{
  return 'success';
}

In controller

use App\Helpers\Helper;

public function index()
{
  $val = Helper::test();
  dd($val);
}

Error : Helper::test() should not be called statically

I called the function inside helper to use it. But got the error as above. Please show me how to get the function in helper. Thank you



via Chebli Mohamed

Laravel complex relationship many to many

I’m building a app in laravel and now I’m doing a payments resource.

The ideia is select many orders in the list to receive in same time. And in this receives can be used many type of payment (money, credit).

Now I has this tables order(id, total), paymentTypes(id, paymentName), payments(id, payment_type_id, value) and order_payments(order_id, payment_id).

This structure is more adequate to this situation? And how can I get orders with all payments and the other orders payed together?

Any help is important.

Thanks everyone .



via Chebli Mohamed

Laravel 5.8 stopped sending email

Sending emails from my system has stopped working at all. .env settings are ok. I tried to run this code to test:

php artisan tinker

Mail::getSwiftMailer()->registerPlugin (
    new Swift_Plugins_LoggerPlugin(new Swift_Plugins_Loggers_EchoLogger(false))
);
$to = 'youraddress@example.com';
Mail::raw('Testmail', function ($message) use($to) {  
    $message->to($to)->subject('Testmail'); 
});

and I'm getting this error:

PHP Warning:  stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/usuario/dev/dev-contaja/vendor/predis/predis/src/Connection/StreamConnection.php on line 127
PHP Warning:  stream_socket_client(): unable to connect to tcp://redis:6379 (php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution) in /home/usuario/dev/dev-contaja/vendor/predis/predis/src/Connection/StreamConnection.php on line 127
Predis/Connection/ConnectionException with message 'php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution [tcp://redis:6379]'

I'm using use docker.



via Chebli Mohamed

AJAX json response data undefined in Laravel 5.7

I have to get response data from API I have succeeded in response but when I am getting one response of data then I have got an undefined error. I am trying to get an error message from API on button click event or display the alert message of API error response of data.

Controller :

 public function apiStatus(Request $request)
{

    $to =  $this->shop->api_test_phone;

    $curl = curl_init();
    $response = my_api;

    curl_setopt($curl, CURLOPT_URL, $response);
    curl_exec($curl);

    $response = json_encode($response);
    curl_close($curl);
    return $response;
}

Blade file:

<script type="text/javascript">
$(document).on('click','#checkApi',function(){
    startAjaxLoading();
    $.ajax({
            type: "GET",
            cache: false,
            url: "",
            success: function (response) 
            {
                console.log(response);
            
                if (response == true) 
                { 
                    var msg = response.message;
                    console.log(msg);
                    notie.alert({text: msg });
                    stopAjaxLoading();
                }
                else
                {
                    var msg = response.message;
                    console.log(msg);
                    notie.alert({ text: msg });
                    stopAjaxLoading();
                }
            }     
        });
    });


via Chebli Mohamed