vendredi 29 septembre 2023

Supervisor setup on laravel error can't find command 'php'

I am setup a Supervisor Configuration on my bitnami LAMP server but when I am ruining sudo supervisorctl error coming 'laravel_queue:laravel_queue_00 FATAL can't find command 'php''

My supervisor .conf file

'[program:laravel_queue]
process_name=%(program_name)s_%(process_num)02d
command=php /opt/bitnami/..../public/artisan queue:work --tries=1
directory=/opt/bitnami/...../public
startsecs = 0
autostart=true
autorestart=true
user=root
numprocs=1
redirect_stderr=true
stderr_logfile=/opt/bitnami/..../public/storage/logs/laraqueue.err.log
stdout_logfile=/opt/bitnami/...../public/storage/logs/laraqueue.out.log
stderr_logfile_maxbytes=1MB
stdout_logfile_maxbytes=1MB'

As a newbies please suggest how to debug this issue.

when run php artisan queue:work on my web root found permission error so change the permission as per requirement & command running smoothy.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/OaEL6AU
via IFTTT

How to connect laravel snowflake database [closed]

How to connect laravel snowflake database



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/MeGzBgZ
via IFTTT

mercredi 27 septembre 2023

Laravel bosnadev/repository package issue when upgraded the laravel version from 5.8 to 10

I upgraded my laravel application that was previously using 5.8 to laravel 10. There is a following issue: Class "Bosnadev\Repositories\Eloquent\Repository" not found I try to install the package using composer require bosnadev/repositories. The following error message comes:

Problem 1 bosnadev/repositories[dev-master, dev-develop, 0.13, ..., 0.x-dev] require illuminate/support ^5.2 -> found illuminate/support[v5.2.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflict s with another require. bosnadev/repositories[0.1, ..., 0.12] require illuminate/support 5.* -> found illuminate/support[v5.0.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflicts with another require. bosnadev/repositories 0.x-dev is an alias of bosnadev/repositories dev-master and thus requires it to be installed too. Root composer.json requires bosnadev/repositories * -> satisfiable by bosnadev/repositories[dev-master, dev-develop, 0.1, ..., 0.x-dev (alias of dev-master)].

You can also try re-running composer require with an explicit version constraint, e.g. "composer require bosnadev/repositories:*" to figure out if any version is installable, or "composer require bosnadev/repos itories:^2.1" if you know which you need.

I tried to remove the problem but I get same error by making changes in composer.json file but still it does not allowed to install. So I need assistance in how to solve it.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/AEiGFh2
via IFTTT

Why do Refresh Token expires after every 7 days ? Does it affects the file upload on production

I implemented a Laravel web-app with Google Drive's API used for storage. I used this tutorial https://gist.github.com/sergomet/f234cc7a8351352170eb547cccd65011. When i am trying to upload file on google drive i am facing the issue of refresh token expiration every 7 days .So if refresh token is being expired it affects the file upload on google drive I need to deploy on production.

I tried with this code, moral of the story is that whether access token expires or refresh token expires , while file upload flow should not give error

public function uploadFile(UploadedFile $uploadedFile, string $file,string $folderId)
    {
        $client = new Google_Client();
        $client->setClientId(env('GOOGLE_DRIVE_CLIENT_ID'));
       $client->setClientSecret(env('GOOGLE_DRIVE_CLIENT_SECRET'));
       $client->refreshToken(env('GOOGLE_DRIVE_REFRESH_TOKEN'));
        $this->refreshTokenIfNeeded($client);
        $fileName = $uploadedFile->getClientOriginalName();
        $mimeType = $uploadedFile->getClientMimeType();
        $fileContent = file_get_contents($uploadedFile);
        $fileMetadata = new Google_Service_Drive_DriveFile(array(
            'name' => $fileName,
            'parents' => array($folderId)
        ));
        //file upload code
}
 public function refreshTokenIfNeeded(Google_Client $client): void
    {

        if ($client->isAccessTokenExpired()) {
          $client->fetchAccessTokenWithRefreshToken($client->getRefreshToken());
           $newAccessToken = $client->getAccessToken();
            $this->saveAccessTokenToStorage($newAccessToken);
    }
 else {
            $oldAccessToken = $client->getAccessToken();
            $this->saveAccessTokenToStorage($oldAccessToken);
        }
    }

    public function saveAccessTokenToStorage($newAccessToken): void
   {
       $accessTokenJson = json_encode($newAccessToken);
        $credentialsFilePath = env('GOOGLE_CREDENTIALS_FILE');
       Storage::put("$credentialsFilePath", $accessTokenJson);
    }
}


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/dVLKeEx
via IFTTT

mardi 26 septembre 2023

Vue.js codes are not working in Production

I'm working on a client webapp which is on Laravel 5.6 with Vue.js (2.5.7). I'm new to Vue.js. Today, I updated few of my Vue.js codes and pushed to production. It is working on local but is not working on Production, although I can clearly see the codes there.

Can an Vue expert please suggest what could be the reason?

Thanks in advance,



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/jpSH0n9
via IFTTT

samedi 23 septembre 2023

ErrorException (E_NOTICE) Undefined index: model Matt excel laravel

I am trying add data to database via excel file but it was working for a moment then it throws undefined index error

import function

 public function importExcel(Request $request)
    {

        if ($request->hasFile('file')) {

            Excel::load($request->file('file')->getRealPath(),  function ($reader) {
                foreach ($reader->toArray() as $row) {
                  
                    $data['date'] = $row['date'];
                    $data['chassis_no'] = $row['chassis_no'];
                    $data['model'] = $row['model'];
                    $data['color'] = $row['color'];
                    $data['supervisor'] = $row['supervisor'];
                    $data['technician'] = $row['technician'];
                    $data['job_card_type'] = $row['job_card_type'];
                    $data['total_amount'] = $row['total_amount'];
                    $data['remark'] = $row['remark'];



                    $jobcard = new Jobcard();

                    $jobcard->created_at =Carbon::parse($row['date']);
                    $jobcard->chasis_no = $row['chassis_no'];
                    $jobcard->model = $row['model'];
                    $jobcard->color = $row['color'];
                    $jobcard->supervisor = $row['supervisor'];
                    $jobcard->technician =  $row['technician'];
                    $jobcard->jobcard_type =$row['job_card_type'];
                    $jobcard->total_amount = $row['total_amount'];
                    $jobcard->created_id = auth()->user()->id;
                    $jobcard->remark = $row['remark'];


                    $jobcard->save();


                }
            });
            return back()->with('success', 'Your File Is Successfully Uploaded To Database!');
        }
        return back()->with('success', 'File Doesnt Uploaded!');
    }

View

 <div class="col-md-5">
    <div class="form-group">
        <form class="form-horizontal" action="" method="post" enctype="multipart/form-data">
            
            <div class="input-group">
                <div class="custom-file">
                  <input type="file" class="custom-file-input" name="file">
                  <label class="custom-file-label" for="inputGroupFile04">Choose file</label>
                </div>

              </div>
              <br><br>
              <div class="col-9">
                <button type="submit" class="btn btn-info waves-effect waves-light w-lg rbutton">
                    Upload
                </button>
            </div>

           </form>
    </div>
</div>

Excel File enter image description here



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/U1MbASv
via IFTTT

vendredi 22 septembre 2023

The POST method is not supported for this route Laravel

Payment success redirect working but if the payment has been cancelled, it does not redirect. How can i fix this? Payment success redirect working but if the payment has been cancelled, it does not redirect. How can i fix this? Error: The POST method is not supported for this route. Supported methods: GET, HEAD. Error İmage: enter image description here

Paymax:

else if($payment_method == "paymax"){
        $sid = 1;

        $settings = Settings::editGeneral($sid);

        $paymaxHelper = new Paymax(
                                    $settings->paymax_username,
                                    $settings->paymax_password,
                                    $settings->paymax_shopcode,
                                    $settings->paymax_hash
                                );

        $site_currency = ( $site_currency == "USD" ? "USD" : $site_currency);
        $order_data = array(
            'productName' => $item_names_data,
            'productData' => array(
                array(
                    'productName'=>$item_names_data,
                    'productPrice'=>$final_amount,
                    'productType'=>'DIJITAL_URUN',
                ),
            ),
            'productType' => 'DIJITAL_URUN',
            'productsTotalPrice' => $final_amount,
            'orderPrice' => $final_amount,
            'currency' => $site_currency,
            'orderId' => $purchase_token,
            'locale' => 'tr',
            'conversationId' => '',
            'buyerName' => $order_firstname,
            'buyerSurName' => $order_firstname,
            'buyerGsmNo' => '05xxXXXxxXX',
            'buyerIp' => $_SERVER['REMOTE_ADDR'],
            'buyerMail' => $order_email,
            'buyerAdress' => '',
            'buyerCountry' => '',
            'buyerCity' => '',
            'buyerDistrict' => '',
            'callbackOkUrl' => $website_url.'/paymax-success/'.$purchase_token,
            'callbackFailUrl' => $website_url.'/paymax-failure/'.$purchase_token
        );
        /*Sipariş Bilgilerinizi link oluşturmak için sınıfa gönderin*/
        $request = $paymaxHelper->create_payment_link($order_data);
                                
        if($request['status']=='success' && isset($request['payment_page_url']))
        {
            $odeme_link = $request['payment_page_url'];
            return redirect($odeme_link);
        }
        
      

   return view('deposit')->with($totaldata);


}

    public function paymax_callback(Request $request){
    $ord_token = $request->orderId;
        
    $itemOrder = DB::table('item_order')->where('purchase_token', $ord_token)->first();
    if($itemOrder){
        $response = $this->paymax_order_success($ord_token, $request);
    }else{
        $response = $this->deposit_paymax_success($ord_token, $request);
    }
    if($response["status"]){
        echo 'OK';
        exit();
    }
    echo $response["message"];
    exit();
}

Failure:

    public function paymax_failure($ord_token, Request $request){
    return view('cancel');
}

Routes:

Route::get('/paymax-success/{ord_token}', ['as' => 'paymax-success','uses'=>'ItemController@paymax_success']);

Route::get('/paymax-failure/{ord_token}', ['as' => 'paymax-failure','uses'=>'ItemController@paymax_failure']);

Route::post('/paymax-callback', ['as' => 'paymax-callback','uses'=>'ItemController@paymax_callback']);


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/0Yz8dT2
via IFTTT

mercredi 20 septembre 2023

Filament decrypt data

How I have encrypted data in Laravel filament before storing it in the database and then I can't decrypt it before displaying in Laravel filament. How can I achieve this in Laravel filament?

Fields I want to encrypt Name, Email.

I am not able to achieve it. Please help me in it.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/CigK7Yf
via IFTTT

mardi 19 septembre 2023

Getting ModSecurity: Access denied with code 44 on Laravel Form Submit

I am trying to submit a form in Laravel but getting this error:

ModSecurity: Access denied with code 44 (phase 2). Match of "eq 0" against "MULTIPART_STRICT_ERROR" required. [file "/etc/httpd/conf.d/mod_security.conf"] [line "31"] [id "200002"] [msg "Multipart request body failed strict validation: PE 0, BQ 0, BW 0, DB 0, DA 0, HF 0, LF 0, SM 0, IQ 1, IP 0, IH 0, FL 0"]

No file upload nothing, it's just simple form submit.

I tried without special chars in form data but still getting this error.

Any suggestions?

I tried submitting data w/o special chars I tried (earlier) uploading a file w/o special chars in the file name



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/qkSIF3C
via IFTTT

mercredi 13 septembre 2023

In this code i can't run operation to insert database in laravel , may anyone askme where is wrong in my code

the controller

public function storeToDatabase(Request $request)
    {
        $params = $request->except('_token');
    
        $user_id = auth()->user()->id;
        $product_id = $params['product_id'];
        $price = $params['price'];
        $quantity = $params['quantity'];
        $name_product = $params['name_product'];
        $total_price = $params['total_price'];
    
        Cart::create([
            'user_id' => $user_id,
            'product_id' => $product_id,
            'price' => $price,
            'quantity' => $quantity,
            'name_product' => $name_product,
            'total_price' => $total_price,
        ]);
    
        \Session::flash('success', 'Product ' . $name_product . ' berhasil dimasukan keranjang.');
    
        return redirect('/carts');
    }

Just eror and no console in error, idont use dd in console and then i dont know what wrong in my code



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/0T6etgj
via IFTTT

"Your requirements could not be resolved to an installable set of packages"

I'm attempting to run an existing Laravel project that I downloaded from GitHub. When I type 'composer update,' I encounter the following error (please refer to the attached image).

Could the reason behind this error be that my PHP version doesn't match the version specified in the project I downloaded?

error massage

Explain this to me



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/Mzlhcam
via IFTTT

Metamask Dapp Browser Not Redirecting from HTTP to HTTPS on Certain Mobile Phones

I'm developing a web-based decentralized application (Dapp) that interacts with Ethereum using Metamask. I've noticed an issue with the Metamask Dapp browser on some mobile phones. When users type a URL with the http protocol instead of https, the Dapp browser does not automatically redirect to the secure https version of the website.

On most mobile phones, this redirection works as expected, but on a subset of devices, it doesn't. This behavior is causing a security concern as the application relies on HTTPS to ensure the confidentiality and integrity of data.

Here are some details:

  • The web server is properly configured to handle both HTTP and HTTPS requests.
  • The APP_URL in my Laravel application is set to use https in the .env file.
  • The Metamask extension is up to date on all devices.

I'd like to understand why this issue is occurring and if there are any specific settings or configurations I need to adjust to ensure that the Metamask Dapp browser consistently redirects from HTTP to HTTPS on all mobile devices.

Has anyone encountered a similar issue with Metamask on mobile phones, and if so, how did you resolve it? Any insights or guidance on this matter would be greatly appreciated.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/YGrdpPj
via IFTTT

lundi 11 septembre 2023

laravel-permission Is there a binding relationship between permissions and routes when the user middleware determines permissions?

For example, in the following figure: permission:member_info|member_add is added to the member routing group. If a user has one of these two permissions, the entire member routing can be accessed. Do we have to write them down on specific routes one by one? That's a lot. It doesn't feel that way. If it is not written in the specific route, how should this permission and route be bound? enter image description here

I don't know what to do at the moment, but I feel that it is unscientific to write on the route one by one.

Like the previous comparison url, the permission is the url, which is checked from the data table and compared with the current request url



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/WZGIjU6
via IFTTT

lundi 4 septembre 2023

Connecting to an SFTP using Storage in Laravel

I Stumbled upon (not sure if its unique) a very tricky situation , when I try to connect to an SFTP with invalid credentials or is not enabled.

The first time I try to connect to SFTP which is not available it throws me proper error message but If I try to reconnect to same SFTP within a minute or 2 it does not throw any exception, I tested the same via php artisan tinker of LARAVEL.

    function conectToSFTP()
    {
        $diskName = 'sftp_name';
        try {
            $disk = Storage::disk($diskName);
            $files = $disk->files('/');
            echo "connected to sftp";
        } catch (\Exception $e) {
            echo "Unable to connect to SFTP " . $e->getMessage();
        }
    }

enter image description here

How can I get proper error message second time as well. Due to some reason or based on some condition I have to call

Storage::disk($diskName);

twice.

I tried adding a time delay using

sleep(45);

but that didnt worked



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/KBZVkdm
via IFTTT

Xlsx file not able to read data in laravel 5.2

I am using laravel 5.2 and "maatwebsite/excel": "~2.1.0", I am not able to read xlsx file data i am getting response empty data My code is here

Excel::load($filePathNew, function($reader) {
$results = $reader-\>get();
$results = $reader-\>all();
dd($results);
});


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/WR1I4nf
via IFTTT

vendredi 1 septembre 2023

Seeking Guidance for Migrating Laravel 5.4 Web App to a New Domain [closed]

I'm in need of your valuable advice.

We are currently working on a Laravel project, and our Laravel web app is connected to a mobile app via an API. Now, we're planning to move the web app to a new domain. However, there's a catch - our Laravel version is a very outdated 5.4 version, and unfortunately, we've lost access to the source code. Luckily, we do have a server backup file.

Could anyone kindly suggest a method for deploying this code on the new domain?

Thank you in advance.

Laravel 5.4 Web App Migration Help Required.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/uSpwMvy
via IFTTT

Authentification failed [closed]

I develop in Laravel and I need to do authentication with two roles but it does not work : if the role of the user is a technician or engineer the system must go to the homet.blade.php page ,

here the code is what the syntax is just :

@if (Auth::user()->role == "Technician" xor Auth::user()->role == "Engineer" )

window.location = "/homet";

@endif

I tried to insert the logical operation "xor" but it does not work



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/ekltwMT
via IFTTT