lundi 18 décembre 2023

Retrieve Comments parent on polymorph relationship with only specific columns

Based on Laravel example Comment has polymorph relationship with Post and Video Model.

I can retrieve Comment with Post and Video using $comment->commentable, but it return all columns of Post or Video. Post has id, name, other columns... Video has id, title, other columns...

How to limit certain columns ? I want for Post only id and name columns and for Video only id and title columns

->with(['commentable' => function ($query) {
          $query->select('id', 'name');
      }])

This code will error since Video doesnt have name columns.



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

mercredi 6 décembre 2023

FatalErrorException in Handler.php line 26

While migrating to Laravel 5.0 from 4.2 I am getting this error

FatalErrorException in Handler.php line 26: Uncaught TypeError: Argument 1 passed to App\Exceptions\Handler::report() must be an instance of Exception, instance of Error given, called in \vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php on line 74 and defined in C:\app\Exceptions\Handler.php:26 Stack trace: #0 \vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(74): App\Exceptions\Handler->report(Object(Error)) #1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Error)) #2 {main} thrown

I have migrated one application from laravel 4.2 to laravel 5.0, placed all the code according to requirement and done composer update command but white executing this I am getting this error.



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

How can I use websockets in Flutter?

I am trying to implement WebSockets for a Laravel-Flutter project. For the Laravel side, I followed these steps. If you see anything wrong or missing, please feel free to say:

https://gist.github.com/emir-ekin-ors/79e670eb6ea970af38c476a8087c19ea

When I test it with Tinker, I can see the event in the dashboard. So I assume the Laravel part is working properly.

The problem is when I try to listen to the channel in Flutter. I can't see anything on the terminal. I tried to follow the documentation of the web_socket_channel package. I am open to all the suggestions since I know nothing about websockets. You can find the Flutter code below:


import 'dart:async';

import 'package:flutter/material.dart';
import 'package:web_socket_channel/web_socket_channel.dart';

void main() {
    runApp(MyApp());
}

class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
        return MaterialApp(
            home: MyWebSocketScreen(),
        );
    }
}

class MyWebSocketScreen extends StatefulWidget {
    @override
    _MyWebSocketScreenState createState() => _MyWebSocketScreenState();
}

class _MyWebSocketScreenState extends State<MyWebSocketScreen> {
    late final _channel;
    late StreamSubscription _streamSubscription;

    @override
    void initState() {
        super.initState();
        _channel = WebSocketChannel.connect(Uri.parse('wss://localhost:6001'));
        _streamSubscription = _channel.stream.listen((data) {
            print('Received: $data');
        }, onError: (error) {
            print('Error: $error');
        });
    }

    @override
    Widget build(BuildContext context) {
        return Placeholder();
    }

    @override
    void dispose() {
        _streamSubscription.cancel();
        _channel.sink.close();
        super.dispose();
    }
}

This is the NewMessage class in Laravel if it necessary:


<?php

namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class NewMessage implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public $message;

    public function __construct($message)
    {
        $this->message = $message;
    }

    public function broadcastOn(): array
    {
        return [
            new Channel('home'),
        ];
    }
}


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

samedi 2 décembre 2023

I have encrypted data in the database how to decrypt it before displaying in the frontend in crocodic-studio / crudbooster?

I have the following form -

$this->form[] = ['label'=>'Client Name','name'=>'client_id','type'=>'select','validation'=>'required|integer|min:0','width'=>'col-sm-10','datatable'=>'client,client_name','datatable_where'=>'status=1'];
$this->form[] = ['label'=>'Client Code','name'=>'user_id','type'=>'select','validation'=>'required|integer|min:0','width'=>'col-sm-10','datatable'=>'cms_users,name','datatable_where'=>'id_cms_privileges = 3 and blocked=0','parent_select'=>'client_id'];

cms_users,name is encrypted using the laravel encryption - Crypt::encryptString($postdata['name'], env('ENC_KEY'));

Now the problem is when I am clicking on the Client name dropdown I get the encrypted value in the Client Code dropdown.

I want to decrypt the value before displaying to the Client Code dropdown. How to solve this issue??

enter image description here



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

vendredi 1 décembre 2023

Laravel validation regex depends upon dependent answer

We have 2 questions 'temp_id_type' with Select Options 'A','B', 'C' 'temp_id' text field

Validation rule required on temp_id

  • requied_if:temp_id_type,A,B,C Also I need regex rule on temp_id
  • if temp_id_type=A - regex should match: ^[0-9]{13}$
  • if temp_id_type=B - regex should match: ^[0-9]{13,20}$
  • if temp_id_type=C - regex should match: ^[A-Z]{2}[0-9]{2}[A-Z0-9]{1,35}$


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

mercredi 29 novembre 2023

Getting data from database in jquery

I want to get yeniseries values ​​from the database, i can use the API but I don't know what I should add to the javascript code, I would be happy if you help me.

var yeniSeries = [50, 80, 30];

window.addEventListener("load", function () {
  try {
    var grafikYapilandirma = {
      chart: {
        type: "donut",
        width: 370,
        height: 430,
      },
      colors: ["#622bd7", "#e2a03f", "#e7515a", "#e2a03f"],
      dataLabels: {
        enabled: false,
      },
      legend: {
        position: "bottom",
        horizontalAlign: "center",
        fontSize: "14px",
        markers: {
          width: 10,
          height: 10,
          offsetX: -5,
          offsetY: 0,
        },
        itemMargin: {
          horizontal: 10,
          vertical: 30,
        },
      },
      plotOptions: {
        pie: {
          donut: {
            size: "75%",
            background: "transparent",
            labels: {
              show: true,
              name: {
                show: true,
                fontSize: "29px",
                fontFamily: "Nunito, sans-serif",
                color: undefined,
                offsetY: -10,
              },
              value: {
                show: true,
                fontSize: "26px",
                fontFamily: "Nunito, sans-serif",
                color: "#1ad271",
                offsetY: 16,
                formatter: function (t) {
                  return t;
                },
              },
              total: {
                show: true,
                showAlways: true,
                label: "Total",
                color: "#888ea8",
                formatter: function (t) {
                  return t.globals.seriesTotals.reduce(function (n, e) {
                    return n + e;
                  }, 0);
                },
              },
            },
          },
        },
      },
      stroke: {
        show: true,
        width: 15,
        colors: "#0e1726",
      },
      series: yeniSeries,
      labels: ["Online", "Offline", "Rest"],
      responsive: [
        { breakpoint: 1440, options: { chart: { width: 325 } } },
        { breakpoint: 1199, options: { chart: { width: 380 } } },
        { breakpoint: 575, options: { chart: { width: 320 } } },
      ],
    };

    var grafik = new ApexCharts(
      document.querySelector("#chart-2"),
      grafikYapilandirma,
    );

    grafik.render();

    document
      .querySelector(".theme-toggle")
      .addEventListener("click", function () {
        var yeniSeries = [200, 300, 500];

        grafik.updateOptions({ series: yeniSeries });
      });
  } catch (hata) {
    console.log(hata);
  }
});

I would appreciate it if you could help, thank you



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

mardi 28 novembre 2023

"Resolving Country Code Bug: How to Fix the country code?"

 <div class="form-group">
                     <label class="form-label required"></label>
                                <input  class="form-control mobilenumber @error('mobile') is-invalid @enderror phone"
                                    type="tel" id="number" name="mobile" onkeypress='validate(event)'>

                                <input type="hidden" id="code" name="countrycode" value="1">

                                @error('mobile')
                                    <div class="invalid-feedback d-block">
                                        
                                    </div>
                                @enderror
                            </div>

Here i want my country code will be bangladesh and it will be fixed.



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

Selenium Appium App Crashed And Returns A Failed Cases

So I have a Selenium Appium Python script for my testing purpose. I created the UI website using Laravel.

My script consists of around 3 test cases: def test_login_success def test_less_phone_number def test_more_phone_number

this is my LoginScriptController:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Storage;

class LoginScriptController extends Controller
{
    public function runLoginScript()
    {
        $command = 'pytest ../automation/app.py -k "test_login_success or test_less_phone_number or test_more_phone_number" 2>&1';
        exec($command, $output, $returnCode);

        if ($returnCode === 0) {
            return response('Script executed successfully', 200);
        } else {
            return response('Script encountered an error', 500);
        }
    }
}

When I click the button "Run test" on my website UI, the app always breaks down (crashed) and the first test case stopped (returns a Failed status). I already tried running it manually from my terminal using pytest app.py -k "test_login_success or test_less_phone_number or test_more_phone_number" but it works ok (returns PASSED status for all cases).

I can't find what's making my app breaks down



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

jeudi 23 novembre 2023

How to print Api response data as collection

I was trying to print API response data as collection on blade for that i have used following line

$customers =   collect(json_decode($response, true));

But whenever i tried to print with following code:

 @foreach($customers as $row)
    <tr>
      <td> </td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
  @endforeach 

it shows bellow error, What's the problem here?

Attempt to read property "first_name" on array

Here is the API response:

Illuminate\Support\Collection {#341 ▼ // app\Http\Controllers\IntegrationController.php:61
  #items: array:1 [▼
    "customers" => array:3 [▼
      0 => array:27 [▼
        "id" => 6895839936762
        "email" => "russel.winfield@example.com"
        "accepts_marketing" => false
        "created_at" => "2023-10-20T11:06:26-04:00"
        "updated_at" => "2023-10-20T11:06:26-04:00"
        "first_name" => "Russell"
        "last_name" => "Winfield"
        "orders_count" => 0
        "state" => "disabled"
        "total_spent" => "0.00"
        "last_order_id" => null
        "note" => "This customer is created with most available fields"
        "verified_email" => true
        "multipass_identifier" => null
        "tax_exempt" => false
        "tags" => "VIP"
        "last_order_name" => null
        "currency" => "USD"
        "phone" => "+16135550135"
        "addresses" => array:1 [▶]
        "accepts_marketing_updated_at" => "2023-10-20T11:06:26-04:00"
        "marketing_opt_in_level" => null
        "tax_exemptions" => []
        "email_marketing_consent" => array:3 [▶]
        "sms_marketing_consent" => array:4 [▶]
        "admin_graphql_api_id" => "gid://shopify/Customer/6895839936762"
        "default_address" => array:17 [▶]
      ]
      1 => array:26 [▶]
      2 => array:26 [▶]
    ]
  ]
  #escapeWhenCastingToString: false
}


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

Laravel notification via method changes not coming in toMail method

I have one class where I calculate variables in via method and the same variable I want to use in toMail method but it's always null in the toMail Method. any idea why?

class FinancialQuestionnaireSubmissionNotification extends Notification implements ShouldQueue
{
    use Queueable,SerializesModels, GlobalMailHelperTrait;

    public Lead $lead;
    public $code;

    public function __construct(Lead $lead)
    {
        $this->lead = $lead->fresh();         
                          
    }
    public function via($notifiable)
    {

        $this->code = 'xyz';            
       
        return ['mail'];
    }
    /**
     * Get the mail representation of the notification.
     */
    public function toMail($notifiable)
    {                    
        dd($this->code);
    }   

    /**
     * Get the array representation of the notification.
     */
    public function toArray($notifiable)
    {
        return [
            //
        ];
    }
}

here my $this->code is always null why even after setting that variable in via method!



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

mardi 21 novembre 2023

Laravel Nova Panel Form Fields Update issue

I am working on nova panel in localhost.. When i perform update my form fields that time i will see this warning...

"Another user has updated this resource since this page was loaded. Please refresh the page and try again."

also i am getting (409 - Conflict) in ajax.

any solution for that?

I will perform cache clear operation

php artisan config:clear

php artisan route:clear

php artisan view:clear


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

samedi 18 novembre 2023

Quantized feature maps with Kmeans, then visualize them on the original image

I extracted feature maps using ResNet, then quantized (segmented) using Kmeans. Now I want to visualize the quantized feature maps (labels) on the input image using Kmeans. Does anyone have an idea how I can do this?

 model = models.resnet18(weights='ResNet18_Weights.DEFAULT')
    model_children = list(model.children())
    feature_extractor = torch.nn.Sequential(\*list(model.children())\[:-2\])

    feature_extractor.eval()

    image_path = 'image.jpg'
    transform = transforms.Compose(\[
    transforms.Resize((224, 224)),
    transforms.ToTensor(),
    transforms.Normalize(mean=0., std=1.)
    \])
    image = transform(Image.open(image_path)).unsqueeze(0)

    with torch.no_grad():
    feature_maps = feature_extractor(image)

    feature = feature_maps.squeeze(0)
    feature = feature.view(512, -1)
    feature = feature.detach().numpy()
    feature= np.transpose(feature)

    \#Kmeans Algorithm
    num_clusters = 10
    kmeans = KMeans(n_clusters=num_clusters,n_init='auto', random_state=0).fit(feature)

    labels = kmeans.labels\_
    labels= labels.reshape(7,7)
    plt.imshow(labels)
    plt.show()


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

vendredi 17 novembre 2023

Laravel 5.8: Laravel Passport API Authentication Issue Outside php artisan serve

I am encountering an authentication problem with my Laravel API when attempting to run it without using php artisan serve. I have implemented Passport for authentication.

The authentication process works seamlessly when using php artisan serve and accessing http://127.0.0.1:8000/api/login in tools like Insomnia. However, I am facing issues when trying to run the Laravel backend independently and connecting it to an Angular frontend.

Despite exploring various solutions suggested online, including updating the .htaccess files in both the root and public folders, the API consistently returns an "unauthenticated" error.

I would appreciate any guidance or assistance in resolving this issue. If anyone has encountered a similar problem or can provide insights into how to make Laravel Passport authentication work outside of php artisan serve, your help would be greatly appreciated.

Thank you in advance for your time and assistance.

  • Updated the .htaccess files in both the root and public folders as recommended in online resources.
  • Checked the Laravel Passport configuration for any misconfigurations.
  • Verified that the Laravel backend is accessible outside of php artisan serve.
  • Ensured that the Angular frontend is making requests to the correct API endpoints.
  • Checked for any relevant error messages in the Laravel logs.

Expectation:

I expected the Laravel Passport authentication to work seamlessly when the backend is accessed independently (without using php artisan serve) from my Angular frontend. However, despite these efforts, the API consistently returns an "unauthenticated" error.



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

lundi 13 novembre 2023

Target [Laravel\Socialite\Contracts\Factory] is not instantiable. [Continue With Google]

(https://i.stack.imgur.com/QkRq7.png)

[problem](https://i.stack.imgur.com/VTYnY.png)

[.env](https://i.stack.imgur.com/LLLMc.png)

[web.php](https://i.stack.imgur.com/vrQtX.png)

[Controller](https://i.stack.imgur.com/dOwxA.png)

When a user clicks on "Continue with Google," it opens the Google sign-up page, but an error is displayed. Everything appears to be in order, and I'm unsure why the error is occurring.. [problem](https://i.stack.imgur.com/VTYnY.png)



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

dimanche 12 novembre 2023

Laravel project code not refelcting changes to view files

I created a laravel(5.1.3) project with breeze as the starter kit. I am planning to use the react as frontend to this project. I run the 'php artisan serve' command. The boiler plate template is working but any changes to files /resources/js/Pages/Welcome.jsx or /resources/views/welcome.blade.php is not reflecting. I have tried

  1. clearing the storage/framework/views folder ,
  2. run command php artisan view:clear ,
  3. run command php artisan config:clear ,
  4. run command composer dump-autoload ,

Still no change to the initial view. What am I doing wrong?

And I configured to make react as frontend library so I don't need the welcome.blade.php file right?



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

samedi 11 novembre 2023

How to send multiple data from view to controller laravel

i want to send data from view to controller ..i.e. 1st card click send id =5 , 2nd card click send id = 6 etc...I can't find answer anywhere on google ...any help will be appreciated...thanks

i tried sendind the variable even aaray by form ..but i am not able to get the desired output.As i said i want to send data on card conditions ..for card 1 send id = 5 , card 2 send id = 6 ..so on

Here is my Code ...

@foreach ($role as $d)
      <form class="form-signin" id="agentPassword" method="POST" action="">
         
        <div class="card_dash card-1" onClick='submitDetailsForm()'>
          <h3>    
          
          <img src="/assets_web/app-icon/icon/web-icon/bix42_" id="role" alt="img">
            <input type="hidden" name="roleInfo[]" value="">
            <!-- <input type="hidden" name="role" value=""> -->
          </h3>
        </div>
      </form>
      @endforeach

the id value in already in $d[1] ...its even better if i can send the whole array $d.



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

Hii i am create a new laravel project in laravel 5.1.3 version and my php version is 8.2.12.please help me to solve this errors

Problem 1 - laravel/framework[v10.10.0, ..., v10.31.0] require league/flysystem ^3.8.0 -> satisfiable by league/flysystem[3.8.0, ..., 3.19.0]. - league/flysystem[3.3.0, ..., 3.14.0] require league/mime-type-detection ^1.0.0 -> satisfiable by league/mime-type-detection[1.0.0, ..., 1.14.0]. - league/flysystem[3.15.0, ..., 3.19.0] require league/flysystem-local ^3.0.0 -> satisfiable by league/flysystem-local[3.15.0, 3.16.0, 3.18.0, 3.19.0]. - league/mime-type-detection[1.0.0, ..., 1.3.0] require php ^7.2 -> your php version (8.2.12) does not satisfy that requirement. - league/mime-type-detection[1.4.0, ..., 1.14.0] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension. - league/flysystem-local[3.15.0, ..., 3.19.0] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension. - Root composer.json requires laravel/framework ^10.10 -> satisfiable by laravel/framework[v10.10.0, ..., v10.31.0].

To enable extensions, verify that they are enabled in your .ini files: - C:\Program Files\php-8.2.12\php.ini

Hii i am create a new laravel project in laravel 5.1.3 version and my php version is 8.2.12.please help me to solve this errors. i have enabled the file-info extension then also same error.



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

dimanche 5 novembre 2023

Get all children categories of a collection of categories without using foreach in Laravel

so I have this codes in my Category model. What it does is, you give it a single category collection and it will return all children category ids of that category in a one dimensional array of ids that can be used in a whereIn query.

private $descendants = [];

public function subcategories()
    {
      return $this->hasMany(Category::class, 'parent_id');
    }

public function children()
    {
        return $this->subcategories()->with('children');
    }

public function hasChildren(){
        if($this->children->count()){
            return true;
        }

        return false;
    }

public function findDescendants(Category $category){
        $this->descendants[] = $category->id;

        if($category->hasChildren()){
            foreach($category->children as $child){
                $this->findDescendants($child);
            }
        }
    }

public function getDescendants(Category $category){
        $this->findDescendants($category);
        return $this->descendants;
}

Usage:

$category = Category::where('id',$id)->first();
$children_ids = [];
$children_ids = $category->getDescendants($category);

It works. It is very useful in my filter. But when it comes to getting children ids of multiple categories, I had to use foreach loop and I had to call getDescendants multiple times thus creating multiple queries. What I want to accomplish are:

  1. To improve performance how to do it in a single query without the need of using foreach loop? Where I want to feed it not just a single category but a collection of categories, and then it should return all children category ids of those categories.
  2. How to return not just children ids but entire collection of children categories?

What usage I had in mind (please feel free to suggest a better approach)

Getting children ids from category collections:

$category = Category::where('parent_id',$id)->get();
$children_ids = [];
$children_ids = $category->getDescendants($category);

Getting children collection from category collections.

$category = Category::where('parent_id',$id)->get();
$children_ids = [];
$children_ids = $category->getDescendants($category);

Please help me accomplish this. Thank you.



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

display students data rank wise as similar to e-commerce website

I have to display the data of students as it is shown in e-commerce website like amazon. First image of the student, then below it name and then the rank of the student. The number of students is dynamic. I am fetching it from database. But how can I present data in such fashion without using html table. Is there any other way to present data row column format without using table? How can I do it in Laravel?



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

mercredi 1 novembre 2023

header style with EASY DATATABLE VUE 3

I'm experiencing difficulties with the table header's appearance, as shown in the picture. It doesn't match the desired style. Can you assist me in resolving this issue? enter image description here i try using easy data table css, but he dosen't work (https://i.stack.imgur.com/7hdwt.png)



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

lundi 30 octobre 2023

Get query results even with null foreign key

I have a query in which I have multiple relationships.

The foreign key 'acquirente_corretor_id' can be null or not. If it is different from null, it has a relationship with the dobby table.

I have the following query, but it only works for 'acquirente_corretor_id' that is not null. Only displays the result with this key other than null.

I want it to show the result of 'acquirente_corretor_id' even though it is null, merging.

One more thing, you only query the acquirer relationship if the variables $empresa_recebedora, $acquirente, $serial are different from null.

How to make? I've tried different forms of querying and it doesn't show.

$contratos = Contrato::with([
                    'parcela',
                    'cliente',
                    'status',
                    'operador',
                    'tabela',
                    'adquirente',
                    'bancos',
                    'bancos.empresa',
                    'bancos.banco',
                    'adquirente'
                ])
                    ->whereHas('cvs', function ($q) use ($cv) {
                        if (!is_null($cv)) {
                            $q->where('cv', $cv);
                        }
                    })
                    ->whereHas('bancos', function ($q) use ($banco, $empresa_pagadora) {
                        if (!is_null($banco)) {
                            $q->where('banco_id', $banco);
                        }
                        if (!is_null($empresa_pagadora)) {
                            $q->where('empresa_id', $empresa_pagadora);
                        }
                    })
                    ->whereHas('cliente', function ($q) use ($cliente) {
                        if (!is_null($cliente)) {
                            $q->where('nome', 'LIKE', "%{$cliente}%");
                        }
                    })
                    ->whereHas('adquirente.maquineta.empresa', function ($q) use ($empresa_recebedora) {
                        if (!is_null($empresa_recebedora)) {
                            $q->where('empresa_id', $empresa_recebedora);
                        }
                    })
                    ->whereHas('adquirente.maquineta.adquirente', function ($q) use ($adquirente) {
                        if (!is_null($adquirente)) {
                            $q->where('adquirente_id', $adquirente);
                        }
                    })
                    ->whereHas('adquirente.maquineta', function ($q) use ($serial) {
                        if (!is_null($serial)) {
                            $q->where('numero_serie', $serial);
                        }
                    })
                    ->when($status, function ($query, $status) {
                        $query->whereIn('contratos.status_id', $status);
                    })
                    ->when($ca, function ($query, $ca) {
                        $query->where('contratos.conciliacao_adquirente', $ca);
                    })
                    ->when($cb, function ($query, $cb) {
                        $query->where('contratos.conciliacao_bancaria', $cb);
                    })
                    ->when($operador, function ($query, $operador) {
                        $query->where('contratos.operador_id', $operador);
                    })
                    ->when($multiplicador, function ($query, $multiplicador) {
                        $query->where('contratos.multiplicador_id', $multiplicador);
                    })
                    ->when($gerente, function ($query, $gerente) {
                        $query->where('contratos.gerente_id', $gerente);
                    })
                    ->when($indicador, function ($query, $indicador) {
                        $query->where('contratos.indicador_id', $indicador);
                    })
                    ->when($valor_liquido, function ($query, $valor_liquido) {
                        $query->where('contratos.valor_liquido', 'LIKE', "{$valor_liquido}%");
                    })
                    ->where(function ($query) use ($inicio, $fim) {
                        if (!is_null($inicio) && !is_null($fim)) {
                            $query->whereBetween('data_operacao', [$inicio, $fim]);
                        }
                    })                    
                    ->orderBy($request->sortField, $sortOrder)
                    ->get()
                    ->each(function ($query) {
                        $pagadoras = $query->bancos;
                        foreach ($pagadoras as $pagadora) {
                            $empresas[] = $pagadora->empresa['nome'];
                            $bancos[] = $pagadora->banco['nome'];
                            $recebedores[] = $pagadora->cpf . ' - ' . $pagadora->nome;
                        }
        
                        $cvs = $query->cvs;
                        foreach ($cvs as $codigo) {
                            $codigos[] = $codigo->cv;
                        }
        
                        $query->empresas_pagadoras = implode(', ', $empresas);
                        $query->bancos_pagadores = implode(', ', $bancos);
                        $query->lista_codigos = implode(', ', $codigos);
                        $query->recebedores = implode(', ', $recebedores);
                    });

I tried solving it this way, but I get the following error:

Call to undefined method Illuminate\Database\Query\Builder::acquirente()

One more thing, you only query the acquirer relationship if the variables $empresa_recebedora, $acquirente, $serial are different from null

`$contratos = Contrato::with([ 'parcela', 'cliente', 'status', 'operador', 'tabela', 'bancos', 'bancos.empresa', 'bancos.banco', 'adquirente' ]) ->whereHas('cvs', function ($q) use ($cv) { if (!is_null($cv)) { $q->where('cv', $cv); } }) ->whereHas('bancos', function ($q) use ($banco, $empresa_pagadora) { if (!is_null($banco)) { $q->where('banco_id', $banco); } if (!is_null($empresa_pagadora)) { $q->where('empresa_id', $empresa_pagadora); } }) ->whereHas('cliente', function ($q) use ($cliente) { if (!is_null($cliente)) { $q->where('nome', 'LIKE', "%{$cliente}%"); } }) ->whereHas('adquirente', function ($q) use ($empresa_recebedora, $adquirente, $serial) { $q->whereHas('adquirente.maquineta.empresa', function ($q) use ($empresa_recebedora) { if (!is_null($empresa_recebedora)) { $q->where('empresa_id', $empresa_recebedora); } }) ->whereHas('adquirente.maquineta.adquirente', function ($q) use ($adquirente) { if (!is_null($adquirente)) { $q->where('adquirente_id', $adquirente); } }) ->whereHas('adquirente.maquineta', function ($q) use ($serial) { if (!is_null($serial)) { $q->where('numero_serie', $serial); } }); }) ->when($status, function ($query, $status) { $query->whereIn('contratos.status_id', $status); }) ->when($ca, function ($query, $ca) { $query->where('contratos.conciliacao_adquirente', $ca); }) ->when($cb, function ($query, $cb) { $query->where('contratos.conciliacao_bancaria', $cb); }) ->when($operador, function ($query, $operador) { $query->where('contratos.operador_id', $operador); }) ->when($multiplicador, function ($query, $multiplicador) { $query->where('contratos.multiplicador_id', $multiplicador); }) ->when($gerente, function ($query, $gerente) { $query->where('contratos.gerente_id', $gerente); }) ->when($indicador, function ($query, $indicador) { $query->where('contratos.indicador_id', $indicador); }) ->when($valor_liquido, function ($query, $valor_liquido) { $query->where('contratos.valor_liquido', 'LIKE', "{$valor_liquido}%"); }) ->where(function ($query) use ($inicio, $fim) { if (!is_null($inicio) && !is_null($fim)) { $query->whereBetween('data_operacao', [$inicio, $fim]); } }) ->orderBy($request->sortField, $sortOrder) ->get() ->each(function ($query) { $pagadoras = $query->bancos; foreach ($pagadoras as $pagadora) { $empresas[] = $pagadora->empresa['nome']; $bancos[] = $pagadora->banco['nome']; $recebedores[] = $pagadora->cpf . ' - ' . $pagadora->nome; }

            $cvs = $query->cvs;
            foreach ($cvs as $codigo) {
                $codigos[] = $codigo->cv;
            }

            $query->empresas_pagadoras = implode(', ', $empresas);
            $query->bancos_pagadores = implode(', ', $bancos);
            $query->lista_codigos = implode(', ', $codigos);
            $query->recebedores = implode(', ', $recebedores);
        });`


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

dimanche 29 octobre 2023

Unable to display data from database on a card using laravel

Even though there are many solutions provided for this error, I am encoutering, I have not find the solution yet, below is the error I am getting when trying to display data from the database on the bootstrap card ") ErrorException Undefined variable: published_articles (View: /home/nosi/Oresol-Lesotho-Skills-Exercise/blog/resources/views/article_data.blade.php) (View: /home/nosi/Oresol-Lesotho-Skills-Exercise/blog/resources/views/article_data.blade.php"

below is my route inside the web.php:

  Route::get('article_data', 'PublishArticlesController@retrieveArticles')->name('article_data');

below is my controller:

public function retrieveArticles(){

$articles = PublishArticle::latest()->paginate(6);
return view('article_data')->with(['published_articles'=>$articles]);

}

below is my blade file which is inside views, articles_data.blade.php:

    @extends('layouts.public_navbar')

@section('content')
<div class="container text-center">
    <h1>Explore Published Articles</h1>
</div>
<div class="container">
    <div class="card-deck row">
    @foreach ($published_articles as $article)
            <div class="col-xs-12 col-sm-6 col-md-4">
                <div class="card">
                    <div class="view overlay">
                        <a href="#!">
                            <div class="mask rgba-white-slight"></div>
                        </a>
                    </div>
                    <div class="card-body">
                        <h4 class="card-title"></h4>
                        <p>Author: </p>
                        <p class="card-text"></p>
                        <a href="" class="btn btn-primary btn-md">Read more</a>
                    </div>
                </div>
            </div>
        @endforeach
    </div>
</div>

<!-- Add Bootstrap JS and Popper.js scripts (required for Bootstrap) -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.3/dist/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
@endsection

your help will be highly apreciated



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

samedi 28 octobre 2023

Laravel getting data from the database in .js file

I need to change the series values ​​in the .js file by pulling data from the database, how can I do this? @php not working in js file

_wChartTwo.28581ae9.js file:

window.addEventListener("load",function(){try{let s=sessionStorage.getItem("theme");if(JSON.parse(s).settings.layout.darkMode){var o="dark";Apex.tooltip={theme:o};var a={chart:{type:"donut",width:370,height:430},colors:["#622bd7","#e2a03f","#e7515a","#e2a03f"],dataLabels:{enabled:!1},legend:{position:"bottom",horizontalAlign:"center",fontSize:"14px",markers:{width:10,height:10,offsetX:-5,offsetY:0},itemMargin:{horizontal:10,vertical:30}},plotOptions:{pie:{donut:{size:"75%",background:"transparent",labels:{show:!0,name:{show:!0,fontSize:"29px",fontFamily:"Nunito, sans-serif",color:void 0,offsetY:-10},value:{show:!0,fontSize:"26px",fontFamily:"Nunito, sans-serif",color:"#1ad271",offsetY:16,formatter:function(t){return t}},total:{show:!0,showAlways:!0,label:"Total",color:"#888ea8",formatter:function(t){return t.globals.seriesTotals.reduce(function(n,e){return n+e},0)}}}}}},stroke:{show:!0,width:15,colors:"#0e1726"},series:[985,737,270],labels:["Apparel","Sports","Others"],responsive:[{breakpoint:1440,options:{chart:{width:325}}},{breakpoint:1199,options:{chart:{width:380}}},{breakpoint:575,options:{chart:{width:320}}}]}}else{var o="dark";Apex.tooltip={theme:o};var a={chart:{type:"donut",width:370,height:430},colors:["#622bd7","#e2a03f","#e7515a","#e2a03f"],dataLabels:{enabled:!1},legend:{position:"bottom",horizontalAlign:"center",fontSize:"14px",markers:{width:10,height:10,offsetX:-5,offsetY:0},itemMargin:{horizontal:10,vertical:30}},plotOptions:{pie:{donut:{size:"75%",background:"transparent",labels:{show:!0,name:{show:!0,fontSize:"29px",fontFamily:"Nunito, sans-serif",color:void 0,offsetY:-10},value:{show:!0,fontSize:"26px",fontFamily:"Nunito, sans-serif",color:"#0e1726",offsetY:16,formatter:function(e){return e}},total:{show:!0,showAlways:!0,label:"Total",color:"#888ea8",formatter:function(e){return e.globals.seriesTotals.reduce(function(i,l){return i+l},0)}}}}}},stroke:{show:!0,width:15,colors:"#fff"},series:[985,737,270],labels:["Apparel","Sports","Others"],responsive:[{breakpoint:1440,options:{chart:{width:325}}},{breakpoint:1199,options:{chart:{width:380}}},{breakpoint:575,options:{chart:{width:320}}}]}}var r=new ApexCharts(document.querySelector("#chart-2"),a);r.render(),document.querySelector(".theme-toggle").addEventListener("click",function(){let t=sessionStorage.getItem("theme");JSON.parse(t).settings.layout.darkMode?r.updateOptions({stroke:{colors:"#0e1726"},plotOptions:{pie:{donut:{labels:{value:{color:"#bfc9d4"}}}}}}):r.updateOptions({stroke:{colors:"#fff"},plotOptions:{pie:{donut:{labels:{value:{color:"#0e1726"}}}}}})})}catch(s){console.log(s)}});

analytics.blade file:

 <div class="col-xl-4 col-lg-12 col-md-12 col-sm-12 col-12 layout-spacing">
            <x-widgets._w-chart-two title="Sales by Category"/>
        </div>


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

vendredi 27 octobre 2023

What is the optimised way to pull all items related to parent table from the mysql table?

Suppose we have a table of order consisting of order ids, what would be considered 'best practice' in terms of fetching all item data with their order?

Order table:
--------

| id | name | email |  phone | event_id |
|---- |------| -----|-----| -----|
| 1    | Anish  | anish@gmail.com | 8233472332| 1765 |
| 2    | ABC    | abc@gmail.com   | 784472332| 1765 |
| 3    | XYZ    | xyz@gmail.com   | 646322332| 1525 |

items table:
------------


| id | order_id | category |  qty | price |
|---- |------| -----|-----| -----|
| 1    | 1  | person 1 | 2| 299 |
| 2    | 1    | person 2   | 1| 399 |
| 3    | 2    | person 1   | 1| 299 |

I want to fetch all items and their order name, email, phone in a single query.

Expected result

| name | email | category |  qty | price |
|---- |------| -----------|----- | ----- |
|  Anish   | anish@gmail.com   | person 1 | 2| 299 |
| Anish    | anish@gmail.com.  | person 2   | 1| 399 |
| ABC      | abc@gmail.com     | person 1   | 1| 299 |

One to many relation Orders -> items (It has multiple rows related to a single order)

I want to display all items for an event along with name, email, and phone. Please suggest to me the optimized mysql query for the same. I am using laravel 5.2.



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

lundi 23 octobre 2023

I have error while i copy laravel project from shared hosting to local

I want to copy laravel from shared hosting into my computer and run it from xampp server this is my road:

  1. i'm compress public_html folder from host
  2. download it and extract in xampp/htacess/project_name directory
  3. i was export database from server and import in local phpmyadmin
  4. delete vender directory and run composer install
  5. edit config/database.php with my local database information
  6. edit .env file with local information after all i run php artisan serve and i get this error screenshot avilable up there does anybody can help me

enter image description here



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

vendredi 20 octobre 2023

socketlabs not working without plainTextBody

This is working fine but when I am sending without plainTextBody then its not working I need to use without plainTextBody, I need to set just subject and htmlBody .

When I am working without plainTextBody then its not working.

$message->subject = "Simple Html file with text";
$message->plainTextBody = "This is the Plain Text Body of my message.";
$message->from = new EmailAddress("from@example.com");
$message->addToAddress(new EmailAddress("recipient1@example.com", "Recipient #1"));

//Get html content from a file
$pathToHtmlFile = __DIR__ .'../../../ExampleCode/Html/SampleEmail.html'; 
$message->htmlBody = file_get_contents($pathToHtmlFile);
 
//Send the message
$response = $client->send($message);

I am using this one https://www.socketlabs.com/api/ but I do not want to use plainTextBody in our project.



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

lundi 16 octobre 2023

i tired search in google, GPT even Bard nothing change in this code, laravel 5 problem

so i have this code in laravel 5

Customer::where('type', 1)->join('tb_customer_connector', 'tb_contact.id_customer', '=', 'tb_customer_connector.id_customer')
        ->join('tb_technology_tag', 'tb_customer_connector.id_product', '=', 'tb_technology_tag.id')
        ->where('tb_technology_tag.about', $id)
        ->get();

and simply this code i use for make a tabbar that make a fillter based on the technology.about but if a customer have two technology with same about it will make the customer show duoble because duoble connector

duplicate customer image

i already use district and groupBy and other but nothing changes



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

vendredi 13 octobre 2023

How to implement automatic code mapping UML in PHP

How to implement automatic code mapping UML in PHP. guide me which tool is perfect for us. My project running in Laravel 5.6, and I want to Codemapping all the code, So please suggest me solution.

How to implement automatic code mapping UML in PHP



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

jeudi 12 octobre 2023

How can loop and display studentId accoirding to the course_code

I want to display the students ID according to the batchId in table view. example for how I want.

EN01              EN02
12335             58965
45624             78956
46325             78599

This is my controller function.

if($request->courseId!="" && $request->batchId!="")
{
    $courseCodes = batches::where('course_id','=', $request->courseId)->where('id','=',$request->batchId)->get();
}else{
    $courseCodes = batches::where('course_id','=', $request->courseId)->get();
}


$course = courses::where('course_active','Yes')->where('course_active_flag','1')->get();
$users = User::all();

$tabliView = "";

$studentData = DB::table('students')
    ->select('studentId', 'batchId','courseId')
    ->where('courseId', $request->courseId);

if ($request->batchId != "") {
    $studentData->where('batchId', $request->batchId);
}

$studentData = $studentData->get();

And This is my table view with loop

<table class="table table-bordered text-nowrap border-bottom" id="basic-datatable">
    <thead>
        <tr>
            @foreach ($courseCode as $couscode)
                <th class="wd-15p border-bottom-0"></th>
            @endforeach
        </tr>
    </thead>
    <tbody>
        @foreach ($studentData as $student)
            <tr>
                @foreach ($courseCodes as $courseCode)
                    <td>
                        
                        @if ($student->batchId === $courseCode->id)
                            
                        @endif
                    </td>
                @endforeach
            </tr>
        @endforeach
    </tbody>
</table>

Now the result is coming like each course code same student Id is printing but each course code has a unique batchId. Please help me to fix this issue.



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

mardi 10 octobre 2023

Laravel (5.8) observer deleted is not working

I am using Laravel (5.8) and I need to delete a record from table A and then also table B. So I tried Observers, but it never fired the observer's deleted method.

I already used other methods like updating or updated, so I don't know why the deleted method is not firing.
I don't use soft delete, because I didn't make this database schema and I don't have authorities to modify that. But based on what I read from the document, it doesn't matter..right?

Here are my code.

  • Pay Controller.php
public function delete(Request $request, $idx){
    $payData = PaymentData::where('idx', $idx)->delete();
    return response()->json(['status' => true]);
}
  • PayObserver.php
public function deleted(PaymentData $paymentData)
{
        if ($paymentData->pay_type == "PA") {
            $app = AppData::where('oid', $paymentData->oid)->first();

            if (!empty($app)) {
                $app->delete();
            }
        }
}
  • AppServiceProvider.php
public function boot()
{
    \App\Models\PaymentData::observe(\App\Observers\PayObserver::class);
}

I also tried to add the observe statement to boot method in EventServiceProvider.php, but it wasn't working either.
I read the official document but couldn't find any clues..what did I miss?



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

lundi 9 octobre 2023

Laravel 10 Auth Login not working with custom Users table and column names

Info

I have custom name an columns for my Users table and I'm using MSSQL for database. My table is called 'TUsers' and for columns I'm using PascalCase so I have:

  • 'Email' instead of 'email'
  • 'Password' instead of 'password'
  • And all others like created_at, updated_at and remember_token

Registering works fine but there the user is automatically logged in with Auth::login()

The problem

Trying to login returns error "These credentials do not match our records." I have also tried to make a custom LoginController with my own function and I get the same issue using Auth::attempt

  • Tried using bcrypt() as well

What I've tried

I've added this to my User model

public $table = "TUsers";
protected $primaryKey = 'TUserID';

const EMAIL = 'Email';
const PASSWROD = 'Password';
const CREATED_AT = 'CreatedAt';
const UPDATED_AT = 'UpdatedAt';

public function getAuthPassword()
{
    return $this->Password;
}

protected $fillable = [
    'Name',
    'Email',
    'Password',
    'EmailVerifiedAt'
];

protected $hidden = [
    'Password',
    'RememberToken',
];

protected $casts = [
    'EmailVerifiedAt' => 'datetime',
    'Password' => 'hashed',
];

I've also made the following adjustments to auth.php

    'guards' => [
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
        'credentials' => [
            'email' => 'Email',
            'password' => 'Password'
        ]
    ],
],
    'passwords' => [
    'users' => [
        'provider' => 'users',
        'table' => 'PasswordResets',
        'expire' => 60,
        'throttle' => 60,
    ],
],

I've also tried mkaing a custom TUserProvider

<?php
namespace App\Providers;

use Illuminate\Contracts\Auth\UserProvider;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Support\Facades\DB;

class TUsersProvider implements UserProvider
{
    public function retrieveById($identifier)
    {
        return DB::table('TUsers')->where('TUserID', $identifier)->first();
    }

    public function retrieveByToken($identifier, $token)
    {
        return DB::table('TUsers')->where('TUserID', $identifier)->where('RememberToken', $token)->first();
    }

    public function retrieveByCredentials(array $credentials)
    {
        // Retrieve a user by their credentials ('Email' and validate the 'Password')
        $user = DB::table('TUsers')->where('Email', $credentials['Email'])->first();

        if ($user && password_verify($credentials['Password'], $user->Password)) {
            return $user;
        }

        return null;
    }

    public function validateCredentials(Authenticatable $user, array $credentials)
    {
        return password_verify($credentials['Password'], $user->getAuthPassword());
    }

    public function updateRememberToken(Authenticatable $user, $token)
    {
        DB::table('TUsers')->where('TUserID', $user->getAuthIdentifier())->update([
            'RememberToken' => $token,
        ]);
    }
}

And added the following to AuthServiceProvider

   $this->app['auth']->provider('tusers', function ($app, array $config) {
        return new TUsersProvider($app['hash'], $config['model']);
    });

And updated in auth.php the 'provider' parameter under guards.web to 'tusers'.

But then I get the error:

Illuminate\Auth\SessionGuard::__construct(): Argument #2 ($provider) must be of type Illuminate\Contracts\Auth\UserProvider, null given, called in /var/www/html/clients/markj/iatse-new/vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php on line 127



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

Pusher error: auth_key should be a valid app key

guys I did try work with edit and when I click on submit I have this error, but the changes was done and I am guessing why I have this issue

Pusher error: auth_key should be a valid app key .

This is my broadcasting.php

'pusher' => [
        'driver' => 'pusher',
        'key' => env('PUSHER_APP_KEY'),
        'secret' => env('PUSHER_APP_SECRET'),
        'app_id' => env('PUSHER_APP_ID'),
        'options' => [
            'cluster' => env('PUSHER_APP_CLUSTER'),
            'encrypted' => false,
            'useTLS' => false,
            'scheme' => 'http',
            // 'host' => env('PUSHER_HOST'),
            // 'port' => env('PUSHER_PORT', 6379),
            'scheme' => env('PUSHER_SCHEME', 'http'),
            'curl_options' => [
                CURLOPT_SSL_VERIFYHOST => 0,
                CURLOPT_SSL_VERIFYPEER => 0,
            ]
          
        ],
    ],

And this .env file

PUSHER_APP_ID=995591
PUSHER_APP_KEY=644a4ac1988060882370
PUSHER_APP_SECRET=739696537f4fb23b8fcd
PUSHER_APP_CLUSTER=ap1
PUSHER_PORT=6379
PUSHER_SCHEME=http
PUSHER_HOST_PROXY=${HOST}
PUSHER_PATH_PROXY='/websockets'
PUSHER_PORT_PROXY=443
PUSHER_HOST=127.0.0.1
MIX_PUSHER_HOST=${HOST}


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

vendredi 6 octobre 2023

Why laravel users get looged out everytime I deploy an app to heroku

We are using Laravel 5 and spatie-permissions package. Every time we commit something to the master branch, everything gets rebuilt.

Could that be the cause of invalidating all user sessions?

PHP version is 7.4.33. We used auth0 for user login earlier, should we remove it from composer.json?

I've attached the log below

-----> Building on the Heroku-20 stack  
-----> Using buildpacks:  
       1. heroku/php  
       2. https://github.com/harrylewis/heroku-buildpack-potrace.git  
-----> PHP app detected  
-----> Bootstrapping...  
  
 !     WARNING: Your 'composer.lock' is out of date!  
 !   
 !     The 'composer.lock' file in your project is not up to date with  
 !     the main 'composer.json' file. This may result in installation  
 !     of incorrect packages or package versions.  
 !   
 !     The lock file is required in order to guarantee reliable and  
 !     reproducible installation of dependencies across systems and  
 !     deploys. It must always be kept in sync with 'composer.json'.  
 !   
 !     Whenever you change 'composer.json', ensure that you perform  
 !     the following steps locally on your computer:  
 !     1) run 'composer update'  
 !     2) add all changes using 'git add composer.json composer.lock'  
 !     3) commit using 'git commit'  
 !   
 !     Ensure that you updated the lock file correctly, and that you  
 !     ran 'git add' on both files, before deploying again.  
 !   
 !     Please remember to always keep your 'composer.lock' updated in  
 !     lockstep with 'composer.json' to avoid common problems related  
 !     to dependencies during collaboration and deployment.  
 !   
 !     Please refer to the Composer documentation for further details:  
 !     https://getcomposer.org/doc/  
 !     https://getcomposer.org/doc/01-basic-usage.md  
  
-----> Preparing platform package installation...  
-----> Installing platform packages...  
       - php (7.4.33)  
       - ext-oauth (2.0.7)  
       - ext-memcached (3.2.0)  
       - ext-imagick (3.7.0)  
       - ext-ftp (bundled with php)  
       - apache (2.4.57)  
       - composer (2.6.4)  
       - nginx (1.24.0)  
       - ext-gd (bundled with php)  
       NOTICE: detected userland polyfill packages for PHP extensions  
       NOTICE: now attempting to install native extension packages  
       Installing extensions provided by symfony/polyfill-mbstring:  
       - ext-mbstring...   
       Installing extensions provided by symfony/polyfill-iconv:  
       - ext-iconv...   
       Installing extensions provided by symfony/polyfill-ctype:  
       - ext-ctype...   
  
 !     WARNING: Your selected PHP version has reached end-of-life  
 !   
 !     No updates or security fixes have been provided for your PHP  
 !     version series by the PHP Group since 2022-11-28.  
 !   
 !     It is strongly recommended you update your app to a version of  
 !     PHP with "active support" status immediately to ensure you get  
 !     the latest bugfixes and security updates each time you deploy.  
 !   
 !     You may check the list of versions supported by the PHP Group  
 !     and their EOL dates here: http://php.net/supported-versions.php  
 !   
 !     For a list of supported runtimes & extensions on Heroku, please  
 !     refer to: https://devcenter.heroku.com/articles/php-support  
  
-----> Installing dependencies...  
       Composer version 2.6.4 2023-09-29 10:54:46  
       Installing dependencies from lock file  
       Verifying lock file contents can be installed on current platform.  
       Warning: The lock file is not up to date with the latest changes in composer.json.   You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.  
       Package operations: 135 installs, 0 updates, 0 removals  
         - Installing kylekatarnls/update-helper (1.2.1): Extracting archive  
         - Installing symfony/polyfill-ctype (v1.26.0): Extracting archive  
         - Installing vlucas/phpdotenv (v2.6.9): Extracting archive  
         - Installing symfony/polyfill-php80 (v1.26.0): Extracting archive  
         - Installing symfony/css-selector (v5.4.11): Extracting archive  
         - Installing tijsverkoyen/css-to-inline-styles (2.2.5): Extracting archive  
         - Installing symfony/polyfill-php72 (v1.26.0): Extracting archive  
         - Installing symfony/polyfill-mbstring (v1.26.0): Extracting archive  
         - Installing symfony/var-dumper (v4.4.46): Extracting archive  
         - Installing symfony/routing (v4.4.44): Extracting archive  
         - Installing symfony/process (v4.4.44): Extracting archive  
         - Installing symfony/polyfill-php73 (v1.26.0): Extracting archive  
         - Installing symfony/polyfill-intl-normalizer (v1.26.0): Extracting archive  
         - Installing symfony/polyfill-intl-idn (v1.26.0): Extracting archive  
         - Installing symfony/deprecation-contracts (v2.5.2): Extracting archive  
         - Installing symfony/mime (v5.4.13): Extracting archive  
         - Installing symfony/http-foundation (v4.4.46): Extracting archive  
         - Installing symfony/http-client-contracts (v2.5.2): Extracting archive  
         - Installing symfony/event-dispatcher-contracts (v1.1.13): Extracting archive  
         - Installing symfony/event-dispatcher (v4.4.44): Extracting archive  
         - Installing psr/log (1.1.4): Extracting archive  
         - Installing symfony/debug (v4.4.44): Extracting archive  
         - Installing symfony/error-handler (v4.4.44): Extracting archive  
         - Installing symfony/http-kernel (v4.4.46): Extracting archive  
         - Installing symfony/finder (v4.4.44): Extracting archive  
         - Installing psr/container (1.1.2): Extracting archive  
         - Installing symfony/service-contracts (v2.5.2): Extracting archive  
         - Installing symfony/console (v4.4.45): Extracting archive  
         - Installing symfony/polyfill-iconv (v1.26.0): Extracting archive  
         - Installing doctrine/lexer (1.2.3): Extracting archive  
         - Installing egulias/email-validator (3.2.1): Extracting archive  
         - Installing swiftmailer/swiftmailer (v6.3.0): Extracting archive  
         - Installing paragonie/random_compat (v9.99.100): Extracting archive  
         - Installing ramsey/uuid (3.9.6): Extracting archive  
         - Installing psr/simple-cache (1.0.1): Extracting archive  
         - Installing opis/closure (3.6.3): Extracting archive  
         - Installing symfony/translation-contracts (v2.5.2): Extracting archive  
         - Installing symfony/translation (v4.4.45): Extracting archive  
         - Installing nesbot/carbon (1.39.1): Extracting archive  
         - Installing monolog/monolog (1.27.1): Extracting archive  
         - Installing league/mime-type-detection (1.11.0): Extracting archive  
         - Installing league/flysystem (1.1.10): Extracting archive  
         - Installing ralouphie/getallheaders (3.0.3): Extracting archive  
         - Installing psr/http-message (1.0.1): Extracting archive  
         - Installing guzzlehttp/psr7 (1.9.0): Extracting archive  
         - Installing guzzlehttp/promises (1.5.2): Extracting archive  
         - Installing guzzlehttp/guzzle (6.5.8): Extracting archive  
         - Installing laravel/slack-notification-channel (v1.0.3): Extracting archive  
         - Installing php-http/promise (1.1.0): Extracting archive  
         - Installing php-http/httplug (v1.1.0): Extracting archive  
         - Installing php-http/guzzle6-adapter (v1.1.1): Extracting archive  
         - Installing psr/http-factory (1.0.1): Extracting archive  
         - Installing zendframework/zend-diactoros (2.2.1): Extracting archive  
         - Installing symfony/http-client (v5.4.13): Extracting archive  
         - Installing lcobucci/jwt (3.4.6): Extracting archive  
         - Installing nexmo/client-core (1.8.1): Extracting archive  
         - Installing nexmo/client (1.9.1): Extracting archive  
         - Installing laravel/nexmo-notification-channel (v1.0.1): Extracting archive  
         - Installing erusev/parsedown (1.7.4): Extracting archive  
         - Installing dragonmantank/cron-expression (v2.3.1): Extracting archive  
         - Installing doctrine/inflector (1.4.4): Extracting archive  
         - Installing laravel/framework (v5.7.29): Extracting archive  
         - Installing firebase/php-jwt (v5.5.1): Extracting archive  
         - Installing auth0/auth0-php (5.7.0): Extracting archive  
         - Installing auth0/login (5.4.0): Extracting archive  
         - Installing automattic/woocommerce (3.1.0): Extracting archive  
         - Installing aws/aws-crt-php (v1.0.2): Extracting archive  
         - Installing mtdowling/jmespath.php (2.6.1): Extracting archive  
         - Installing aws/aws-sdk-php (3.238.1): Extracting archive  
         - Installing aws/aws-sdk-php-resources (0.3.0): Extracting archive  
         - Installing clue/stream-filter (v1.6.0): Extracting archive  
         - Installing symfony/dependency-injection (v4.4.44): Extracting archive  
         - Installing symfony/polyfill-php81 (v1.26.0): Extracting archive  
         - Installing symfony/filesystem (v5.4.13): Extracting archive  
         - Installing symfony/config (v4.4.44): Extracting archive  
         - Installing dzunke/slack-bundle (2.6.0): Extracting archive  
         - Installing easypost/easypost-php (3.6.0): Extracting archive  
         - Installing facebook/graph-sdk (5.7.0): Extracting archive  
         - Installing fideloper/proxy (4.4.2): Extracting archive  
         - Installing gertjanspriensma/etsy-php (dev-master 95f0cb8): Extracting archive  
         - Installing http-interop/http-factory-guzzle (1.2.0): Extracting archive  
         - Installing mmucklo/inflect (v0.3.0): Extracting archive  
         - Installing zendesk/zendesk_api_client_php (v2.2.15): Extracting archive  
         - Installing huddledigital/zendesk-laravel (v3.7): Extracting archive  
         - Installing jakub-onderka/php-console-color (v0.2): Extracting archive  
         - Installing jeremy-dunn/php-fedex-api-wrapper (3.0): Extracting archive  
         - Installing nikic/php-parser (v4.15.1): Extracting archive  
         - Installing jakub-onderka/php-console-highlighter (v0.4): Extracting archive  
         - Installing dnoegel/php-xdg-base-dir (v0.1.1): Extracting archive  
         - Installing psy/psysh (v0.9.12): Extracting archive  
         - Installing laravel/tinker (v1.0.10): Extracting archive  
         - Installing psr/http-client (1.0.1): Extracting archive  
         - Installing markbaker/matrix (3.0.0): Extracting archive  
         - Installing markbaker/complex (3.0.1): Extracting archive  
         - Installing myclabs/php-enum (1.8.4): Extracting archive  
         - Installing maennchen/zipstream-php (2.2.1): Extracting archive  
         - Installing ezyang/htmlpurifier (v4.16.0): Extracting archive  
         - Installing phpoffice/phpspreadsheet (1.25.2): Extracting archive  
         - Installing maatwebsite/excel (3.1.25): Extracting archive  
         - Installing mixpanel/mixpanel-php (2.10.0): Extracting archive  
         - Installing myparcelnl/sdk (v3.1.7): Extracting archive  
         - Installing omnisend/php-sdk (1.2): Extracting archive  
         - Installing paypal/rest-api-sdk-php (1.14.0): Extracting archive  
         - Installing paragonie/constant_time_encoding (v2.6.3): Extracting archive  
         - Installing phpseclib/phpseclib (3.0.16): Extracting archive  
         - Installing php-amqplib/php-amqplib (v3.3.1): Extracting archive  
         - Installing php-http/message-factory (v1.0.2): Extracting archive  
         - Installing phpclassic/php-shopify (v1.2.5): Extracting archive  
         - Installing picqer/sendcloud-php-client (v2.7.0): Extracting archive  
         - Installing symfony/yaml (v4.4.45): Extracting archive  
         - Installing predicthq/address-formatter-templates (v1.0.0): Extracting archive  
         - Installing mustache/mustache (v2.14.2): Extracting archive  
         - Installing predicthq/address-formatter (v1.1.0): Extracting archive  
         - Installing printnode/printnode-php (2.0.0-rc1): Extracting archive  
         - Installing psr/cache (1.0.0): Extracting archive  
         - Installing starkbank/ecdsa (0.0.5): Extracting archive  
         - Installing sendgrid/php-http-client (3.14.4): Extracting archive  
         - Installing sendgrid/sendgrid (7.11.5): Extracting archive  
         - Installing symfony/polyfill-uuid (v1.26.0): Extracting archive  
         - Installing symfony/options-resolver (v5.4.11): Extracting archive  
         - Installing php-http/message (1.13.0): Extracting archive  
         - Installing php-http/discovery (1.14.3): Extracting archive  
         - Installing php-http/client-common (1.11.0): Extracting archive  
         - Installing jean85/pretty-package-versions (2.0.5): Extracting archive  
         - Installing sentry/sentry (2.5.2): Extracting archive  
         - Installing sentry/sdk (2.2.0)  
         - Installing sentry/sentry-laravel (1.9.0): Extracting archive  
         - Installing setasign/fpdi (v2.3.6): Extracting archive  
         - Installing thecodingmachine/safe (v1.3.3): Extracting archive  
         - Installing setono/post-nord-php-sdk (v1.2.0): Extracting archive  
         - Installing graham-campbell/guzzle-factory (v3.0.4): Extracting archive  
         - Installing spatie/dropbox-api (1.21.0): Extracting archive  
         - Installing spatie/laravel-permission (2.38.0): Extracting archive  
         - Installing stripe/stripe-php (v7.128.0): Extracting archive  
         - Installing tecnickcom/tcpdf (6.5.0): Extracting archive  
       Package dzunke/slack-bundle is abandoned, you should avoid using it. No replacement was suggested.  
       Package facebook/graph-sdk is abandoned, you should avoid using it. No replacement was suggested.  
       Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead.  
       Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead.  
       Package laravel/nexmo-notification-channel is abandoned, you should avoid using it. Use laravel/vonage-notification-channel instead.  
       Package paypal/rest-api-sdk-php is abandoned, you should avoid using it. No replacement was suggested.  
       Package predicthq/address-formatter is abandoned, you should avoid using it. No replacement was suggested.  
       Package predicthq/address-formatter-templates is abandoned, you should avoid using it. No replacement was suggested.  
       Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.  
       Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.  
       Package zendframework/zend-diactoros is abandoned, you should avoid using it. Use laminas/laminas-diactoros instead.  
       Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested.  
       Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.  
       Generating optimized autoload files  
       Class FedEx\Tests\ValidationAvailabilityAndCommitmentService located in ./vendor/jeremy-dunn/php-fedex-api-wrapper/tests/FedEx/Tests/ValidationAvailabilityAndCommitmentServiceTest.php does not comply with psr-4 autoloading standard. Skipping.  
       > Illuminate\Foundation\ComposerScripts::postAutoloadDump  
       61 packages you are using are looking for funding.  
       Use the `composer fund` command to find out more!  
-----> Preparing runtime environment...  
-----> Checking for additional extensions to install...  
-----> Potrace loaded app detected  
-----> Installing potrace  
potrace-1.16.linux-x86_64/  
potrace-1.16.linux-x86_64/README-WIN  
potrace-1.16.linux-x86_64/potrace.1  
potrace-1.16.linux-x86_64/placement.pdf  
potrace-1.16.linux-x86_64/README  
potrace-1.16.linux-x86_64/NEWS  
potrace-1.16.linux-x86_64/ChangeLog  
potrace-1.16.linux-x86_64/mkbitmap.1  
potrace-1.16.linux-x86_64/mkbitmap  
potrace-1.16.linux-x86_64/AUTHORS  
potrace-1.16.linux-x86_64/potrace  
potrace-1.16.linux-x86_64/COPYING  
-----> Discovering process types  
       Procfile declares types -> web, worker  
-----> Compressing...  
       Done: 186.1M  
-----> Launching...  
       Released v318  
       https://my-app.herokuapp.com/ deployed to Heroku  
This app is using the Heroku-20 stack, however a newer stack is available.  
To upgrade to Heroku-22, see:  
https://devcenter.heroku.com/articles/upgrading-to-the-latest-stack


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

jeudi 5 octobre 2023

After change the password login is not working using Laravel

I created the client register and the password change function. When I register the client with the password that password and username are working without any issues. But when I change the password and log in with a new password always says the password is incorrect.I can't understand what is the issue please help me to solve this issue.

This is my register code

public function store(Request $request, client $client)
    {
        
        $token = $request->input('g-recaptcha-response');

        if(strlen($token)>0)
        {
        
            $result = client::where('email', $request->email)->first();
    
            if (!empty($result))
            {
                return Redirect::back()->with('errmessage','The registered email address is already in use. Please contact the website administrator or request a password reset');
            }
    
            $client->clie_id = $request->email;
            $client->clie_fname = $request->clie_fname;
            $client->clie_lname = $request->clie_lname;
            $client->clie_company = $request->clie_company;
            $client->password = Hash::make($request->password);
            $client->email = $request->email;
            $client->clie_telephone = $request->clie_telephone;
            $client->clie_fax = $request->clie_fax;
            $client->clie_address1 = $request->clie_address1;
            $client->clie_address2 = $request->clie_address2;
            $client->clie_address3 = $request->clie_address3;
    
            $client->clie_city = $request->clie_city;
            $client->clie_state = $request->clie_state;
            $client->clie_postcode = $request->clie_postcode;
            $client->clie_country = $request->clie_country;
    
            $client->clie_newslatter= $request->clie_newslatter;
    
            $client->save();
    
            return Redirect::back()->with('message','Account Created Successfully. You may now login using the email you registered with and your password');
            
        }else{
            return redirect()->back()->with('warmessage','Please make sure your not a robot');
        }
    }

This is my password change function

public function PasswordChange(Request $request)
    {
        
        //dd($request->clientId);
        
        $token = $request->input('g-recaptcha-response');

        if(strlen($token)>0)
        {
            $user = Client::where('email', $request->clientId)->first();

            if (!$user) {
                return redirect()->back()->with('error', 'User not found.');
            }
            
            if (!Hash::check($request->old_password, $user->password)) {
                return redirect()->back()->with('error', 'The old password is incorrect.');
            }
            
            $user->update([
                'password' => Hash::make($request->password)
            ]);
            
            // Clear the user's session to ensure the new password takes effect
            Auth::guard('client')->logout();
        
            return redirect()->route('Home')->with('message','Password is Successfully changed.');
            
        }else{
            return redirect()->back()->with('message','Please make sure your not a robot');
        }

        // return redirect()->route('home')->with('success', 'Password changed successfully.');
    }

My login function

public function login(Request $request)
    {
        
        //dd($request->password);
        
        // Retrieve the user record by email
        $user = client::where('email', $request->email)->first();
        
        Log::info('Login attempt:', [
            'email' => $request->email,
            'entered_org_password' => $request->password,
            'entered_password' => Hash::make($request->password),
            'hashed_password' => $user->password,
        ]);
        

        if(Auth::guard('client')->attempt(['email'=>$request->email,'password'=>$request->password],$request->remember))
        {
          return redirect('/')->withMessage('Successfully Logged In');
        }else{
            return redirect(route('Client_Login'))->with('Error');
        }

        return redirect()->back()->withInput($request->only('email'));
    }

This is my log data when login with a new password

After Registering this the records for login.

[2023-10-05 08:34:06] local.INFO: Login attempt: {"email":"james@gmail.com","entered_org_password":"123456789","entered_password":"$2y$10$1mR2dKLEJAHvv0BCQoCfZeLP5Ugq4ngTvHD4/RFDtXp.asB7AJKF.","hashed_password":"$2y$10$Jxm/cd25Xpe4i8ljfDV98uIICszGb61pV6PtcwuhqHayjujWsOejm"} 

After changing the password and login records

[2023-10-05 08:35:21] local.INFO: Login attempt: {"email":"james@gmail.com","entered_org_password":"123456789123","entered_password":"$2y$10$49D4RS5aNWwl8xtnWOGeQ.wuT2Ozipz4O1yAtmJQAsmjoZiLQb3b.","hashed_password":"$2y$10$.dj8Egmzr0JDs7IlmMfZ2ultD5Srp5YTo0Wxi0WHmxscc0P1cpS3u"} 


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

How to update 5000+ records in a set of 200s in laravel?

I have a total of approximately 8000+ records. I want to update them in a set of 200s, so that the site which I am working on, doesn't go down due to excessive queries execution. Right now I am not able to do that.

This is my code:

$totalRecords = DB::table('domain_authority_score_update')->where('update_flag', 0);
$reduceRecords = $totalRecords->take(200)->get();

I have used foreach to update all records.

foreach($reduceRecords as $val){
}

I have tried to update them by using for() loop and also do-while() loop, but it didn't give me the expected result.

I have also tried using chunk(). But I did not succeed.

Any help would be appreciated. Thanks in advance.



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

mercredi 4 octobre 2023

Laravel Post & Comments relation, only post author can delete the comment. but the user who made comment can edit and delete also

I don't have any idea how to do it. if anybody knows about it. let me know. I think its some thing relevant to validation. plz guide me.

only post author can delete the comment. but the user who made comment can edit and delete also



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

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