vendredi 30 septembre 2022

File upload issue using ajax in laravel 6

I am trying to store pdf along with other input value using ajax in laravel 6. Here I did not use form html element . It shows Call to a member function getClientOriginalExtension() on null . How can I send file ?

In Blade

<input name="phone" type="text" class="form-control phone">
<input type="file" name="my_doc" accept="application/pdf" class="my_doc" id="my_doc">

<button type="button" class="store_new"> Save </button>

$(document).on('click', '.store_new', function () {
   var phone= $('.phone').val();
   var my_doc= $('.my_doc').val();

   $.ajax({
        url: '',
        type: "POST",
        headers: {
             'X-CSRF-TOKEN': ''
        },
        data: {
            phone: phone,
            my_doc: my_doc,
        },
        success: function (response) {
                   
        },
        error: function (jqXHR, textStatus, errorThrown) {

        }
     });
});

In controller

use File;

public function store(Request $request)
{
  
    $image = $request->file('my_doc');
    $new_name = rand() . '.' . $image->getClientOriginalExtension();
    $image->move(public_path('final_doc'), $new_name);

}


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

mercredi 28 septembre 2022

I want my selectEnhenced form to show a searched name with its type next to it as a hint

I have this form - for example a form for a new city - with some different selects and inputs. In one of them a user have to choose a commune - a commune for that particular city.

Before, on the select list, there was only a name of a commune, without the type - everything worked perfectly - but then I realised that to choose the right commune, the user need to know it's type too.

What I'm trying to make is something like this: when a user will type a name of a commune, it will show a list of available communes - the name of the commune with the type of that commune next to it:

see the pic

I tried to:

  • change my model - in many different ways - for example by creating a new function that would contain two others;
  • modify ajax - make something similar as in return?

But nothing works. In general I get a 500 server error because I want to put two "names" in one select. Is it possible to make it work the way I want?

Here are examples of my code:

  • FormTrait:

              $form->selectEnhanced('commune_id', trans('dict.commune'))
                  ->options(function ($id) {
                      $id = $id ? $id : old('commune_id');
                      if ($id) {
                          $commune = Commune::find($id);
                          return [$commune->id => $commune->communetranslation->name . ' (' . $commune->communetypetranslation->name . ')'];
                      }
                  })
                  ->ajax('/' . config('admin.route.prefix') . '/api/communes', 'id', 'communetranslation.name')
                  ->loadParent('district_id', '/' . config('admin.route.prefix') . '/api/districts');
    
  • Model:

     public function communetranslation()
     {
      return $this->getRelationDefinition($this->hasOne(CommuneTranslation::class, 'commune_id', 'commune_id'), 'commune_translations', 'commune_id');
     }
    
     public function communetypetranslation()
     {
      return $this->getRelationDefinition($this->hasOne('App\Models\CommuneTypeTranslation', 'commune_type_id', 'id'), 'commune_type_translations', 'commune_type_id');
     }
    


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

mardi 27 septembre 2022

my project on laravel 5 but i can`t install dom pdf package

Problem 1 - Root composer.json requires barryvdh/laravel-dompdf 0.8.2 -> satisfiable by barryvdh/laravel-dompdf[v0.8.2]. - barryvdh/laravel-dompdf v0.8.2 requires dompdf/dompdf ^0.8 -> found dompdf/dompdf[v0.8.0, ..., v0.8.6] but it conflicts with your root composer.json require (^2.0).

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.



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

lundi 26 septembre 2022

What is the difference between using where() clause With() and wherehas() in relationship model

I have two relationship table. I used with using where to filter records as well as i used wherehas using where to filter records. But can't find the differences between both



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

Laravel access admin panel after Logged in flutter app

I have a Laravel web application with admin panel, now I have a flutter app , of which all the screens except login are web views. Here I need to redirect the mobile users to admin panel based on the roles after successfully logged in by mobile app, my question here , that Is it possible to redirect users to admin panel after logged in mobile device trough API, I just want to login through mobile app (API), then I need to access the admin panel without logged in again .. It will be great if any one can help me on this



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

jeudi 22 septembre 2022

Illegal offset type in isset or empty (View: file.blade.php)

I am getting an error in my file.blade.php but every thing in file is correct

traces

FileViewFinder.php (line 71)

public function find($name)    {        
if (isset($this->views[$name])) {

Error starts from line 71 of FileViewFinder.php

any help is appreciated



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

mardi 20 septembre 2022

Protected Properties PHP Laravel

How can access properties of a protected object PHP while writing tests. Below is my sample code. TestCase.php The test fails to run saying that the property is protected. But it can die dumped.

<?php

namespace Tests;

use Illuminate\Http\Response;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
    use CreatesApplication;

    public function getAuthUser()
    {
        $payload = [
            'email' => 'admin@gamil.nl',
            'password' => 'password',
        ];
       return $this->json('post', 'api/v1/auth/login', $payload)
             ->assertStatus(Response::HTTP_OK);
    }
}

my sample test

<?php

namespace Tests\Unit;

use Tests\TestCase;
use Illuminate\Http\Response;

class PatientsControllerTest extends TestCase
{
    /**
     * A basic unit test patient controller.
     *
     * @return void
     */
    public function testPatientFetch()
    {
        $auth_user =  $this->getAuthUser();
        dd($auth_user->data);
    }
}

my sample code

<?php

namespace Tests\Unit;

use Tests\TestCase;
use Illuminate\Http\Response;

class PatientsControllerTest extends TestCase
{
    /**
     * A basic unit test patient controller.
     *
     * @return void
     */
    public function testPatientFetch()
    {
        $auth_user =  $this->getAuthUser();
        dd($auth_user->data);
    }
}

Error received

       FAIL  Tests\Unit\PatientsControllerTest
  ⨯ patient fetch

  ---

  • Tests\Unit\PatientsControllerTest > patient fetch
   PHPUnit\Framework\ExceptionWrapper 

  Cannot access protected property Illuminate\Http\JsonResponse::$data

  at vendor/phpunit/phpunit/phpunit:98
     94▕ unset($options);
     95▕ 
     96▕ require PHPUNIT_COMPOSER_INSTALL;
     97▕ 
  ➜  98▕ PHPUnit\TextUI\Command::main();
     99▕ 



  Tests:  1 failed
  Time:   1.05s



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

ErrorException : Trying to access array offset on value of type int

i'm getting the issue of "Trying to access array offset on value of type int" when i export the data using "maatwebsite/excel": "~2.1.0" Excel package.

Excel::create('Filename', function($excel) use ($data){
  $excel->sheet('Sheetname'), function($sheet)use ($data) {
    $sheet->fromArray($data); //getting error on this line
  });
}); 



$data = 
 array:198 [
   0 => array:19 [
     "Id" => 1
     "First Name" => "John"
     "Last Name" => "Doe"
     "comments" => null
   ]
   1 => array:19 [
     "Id" => 2
     "First Name" => "James"
     "Last Name" => "Harrison"
     "comments" => null
   ]
   ...


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

lundi 19 septembre 2022

I want to create a settings popup in which the user can select the custom directory to read files. How can I do that?

I have tested some files from the public folder of my Laravel app and the path for that is;

C:\xampp\htdocs\EDI_System\public\files\pending

but this one is static I want to make a setting popup where users can set a custom path for that like if the files exist in D:\new_files the setting popup appears and the selection of the directory can be made.

i want my settings to be like that

Your help will be much appriciated. Thank you



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

vendredi 16 septembre 2022

XMLRPC library for API in laravel

I want to use XMLRPC to get my API results and show them in XML format in laravel project. I've seen numerous examples for XMLRPC for PHP but can't find any for laravel yet. API i'm using is Wired wubook api: https://tdocs.wubook.net/wired.html

To access the rates of rooms I've generated the permanent token and lcode to run this code in laravel project: fetch_rooms(token, lcode, ancillary=0) I just don't know the method of XMLRPC through which I can call my wubook api results inside laravel project.

enter image description here

Any help through which I can use XMLRPC in laravel and call my API results in project?



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

jeudi 15 septembre 2022

fix double payments - double purchases

i'm implementing an online payment platform similar to paypal, the problem is that when they click on the buy button 2 times or more quickly and this causes the payment to register twice instead of once

When you click buy execute this action:

     public function invoke(Request $request) {
    
      $payment_id = $request->get('payment_id');
    
      $credenciales = config('services.mercadopago.token');
      $request->get('user_id'));
    
      $response = Http::get("https://api.mercadopago.com/v1/payments/$payment_id" . "?access_token=$credenciales");
      
      $response = json_decode($response);

  $request->session()->put('order', $response->order->id);
  $request->session()->put('ingreso', $response->transaction_details->net_received_amount);
  $request->session()->put('monto', $response->transaction_details->total_paid_amount);
  $request->session()->put('method', $response->payment_type_id); 
 $status = $response->status;

If the answer is approved run this:

if($status == 'approved') {


  Income::insert([
    'user_id'       => Session::get('user_id'),
    'evento_id'       => Session::get('variableName'),
    //Guardar el personal seleccionado
    'mp_id'  => Session::get('order'),
    'metodo'        => Session::get('metodo'),
    'monto'        => Session::get('monto'),
    'rrpp_id'         => Session::get('rrpp'),
    'ingreso'        => Session::get('ingreso'),


  ]);

  OrderNew::insert([
    'user_id'       => Session::get('user_id'),
    'dia_id'       => Session::get('variableName'),
    //Guardar el personal seleccionado
    'whatsapp'  => Session::get('telefono'),
    'cantidad'        => Session::get('cantidad'),
    'anticipada'        => Session::get('anticipada'),
    'horario'        => Session::get('horario'),
    'rrpp'         => Session::get('rrpp'),
    'pagado'        => '1',
    'tipo'        => 'vip',
    'codigo'        => rand(1580, 4005),


  ]);

in the first model I register the incoming money and in the second model I register the customer's order

and there is the problem, if they click on Buy several times, the records are duplicated and they get free products

How can I limit or solve this problem?



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

mardi 13 septembre 2022

Laravel import Seed Class into Command [closed]

I want to execute a Seed Class by running a Laravel Command. My problem is that I can`t correctly import, so my code get thrown with

Target class [TestSeeder] does not exist. inside TestCommand.php.

I am on Laravel 5 and have created both classes via CLI make:seed and make:command, as result the classes are saved in the according folders. I have read some solutions regarding composer dump-autoload but this gets stuck in endless loop, maybe because its a huge codebase..

database\seeds\TestSeeder.php

<?php

use App\Models\Hotel;
use Illuminate\Database\Seeder;

class TestSeeder extends Seeder
{
    public function run(int $id)
    {
       // do stuff with {id}..
    }
}

app\console\commands\TestCommand.php

<?php

use Illuminate\Console\Command;
use Database\Seeds\TestSeeder;

class TestCommand extends Command
{

    protected $signature = 'test:data';

    protected $description = 'Add default data to the database for specific id via Seeder';

    public function __construct()
    {
        parent::__construct();
    }

    public function handle()
    {
        $id = $this->ask('Please enter the id for which you want to add the seed data');

        if (!$id) {
            $this->error('No id given');
            return;
        }

        // $this->call(TestSeeder::class, ['id' => $id]);
        $testSeeder = new TestSeeder();
        $testSeeder->run($id);
    }
}



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

lundi 12 septembre 2022

How to read 2 date formats in laravel-excel (maatsweb v 2.1)

I am using Laravel excel (maatsweb excel v 2.1 https://docs.laravel-excel.com/2.1/import/dates.html) and laravel 5.5.

I have an issue when the field is date and there are 2 formats.

The first format is visible when opening the xcel with an xcel reader like LibreOffice. Lets say the user sees date as "02 Jan 2022"

The second format is visible when I click on the date cell - it shows another format. Lets say "01/02/2022"

When I call

$this->excelObj->get()

this returns one format (lets say "01/02/2022") But when I read the same file with

$this->excelObj->chunk(..

It returns the other format ("02 Jan 2022")

How can I have it read the same way? Is there a setting to make them behave the same?



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

samedi 10 septembre 2022

FatalThrowableError in MailgunTransport.php line 67: Undefined class constant 'VERSION'

I'm getting this error when trying to send email from within my Laravel 5.1 application. This function was working quite well for a very long time, but I stopped using my application for about a year and now when I try to use it I'm getting this error. I don't think I've made any changes to anything related to emails, so I'm not sure what the cause could be.

Here is what my composer.json looks like:

    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.1.*",
        "barryvdh/laravel-ide-helper": "^2.1",
        "laravelcollective/html": "5.1.*",
        "nesbot/carbon": "1.39.*",
        "intervention/image": "^2.3",
        "fzaninotto/faker": "^1.7",
        "bugsnag/bugsnag-laravel": "^2.0",
        "silber/bouncer": " v1.0.0-rc.4",
        "doctrine/dbal": "v2.9",
        "spatie/laravel-medialibrary": "^4.0.0",
        "rap2hpoutre/laravel-log-viewer": "^2.2"
    },
    "require-dev": {
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1"
    },

PHP v7.3



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

Undefined variable: sub inside the foreach loop in laravel

Controller:

public function dashboard()
{
    $course = Course::all();
    return view('content.dashboard',compact('course'));
}

View:

@foreach($course as $year)

    $sub = \App\Models\SubCourse::where('course_id',$year->id)->first();
    @dd($sub->id);

@endforeach

In the above code I am trying to get value of SubCourse but it throw an error i.e. Undefined variable: sub (View: C:\xampp\htdocs\example\resources\views\content\dashboard.blade.php). I don't know why? Please help me.

Thank you



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

vendredi 9 septembre 2022

how to send multipart data in axios with Laravel api

I am using axios.post method to send the data to the server. i make the larvel api. When i check that api in postman, it was working fine. but when i connect that api in frontend it send all data to the backend except my image file. below i mention the code that send the image file to the server. Please check carefully my code and help me out where i am doing wrong. I stuck in this problem since two days.

frontEnd code
  const params = useParams();
  const { some } = params;

  const [name, setName] = useState("");
  const [school, setSchool] = useState("");
  const [author, setAuthor] = useState("");
  const [grade, setGrade] = useState("");
  const [Extra, setExtra] = useState("");
  const [image, setImage] = useState("");

 
  if (some === "book") {
    const handleSubmit = async (e) => {
   e.preventDefault();
  const formData = new FormData();
  formData.append("image", image);
  if (image == null) return image;
  console.log(image, name)

  const token = localStorage.getItem("Token")
  console.log(token)


  try {
    const res = await axios.post(
      `http://127.0.0.1:8000/add-product`,



      {
        formData,

        product_name: name,
        product_auther: author,
        school_name: school,
        class: grade,
        product_image: image,
        category_id: "17"



      },
      {
        headers:

          { "Authorization": `Bearer ${token}` },
          'Content-Type': 'multipart/form-data'   ,
      }



    ).then((res) => {
      console.log("usman    ", res)
    });
    console.log()

   } catch (error) {
    if (error.request) {
      console.log(error.response);

    } else if (error.request) {
      console.log("network error");
    } else {
      console.log("CBM", { error });
    }
  }
}

return (
  <div className="container " style=>
    <br>
    </br>
    <form onSubmit={handleSubmit} >
      <div className="mb-3">
        <label htmlFor="exampleInputEmail1" className="form-label"> Name</label>
        <input type="text" value={name} onChange={(e) => setName(e.target.value)} className="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" />
      </div>
      <div className="mb-3">
        <label htmlFor="exampleInputPassword1" className="form-label">Author</label>
        <input type="text" value={author} onChange={(e) => setAuthor(e.target.value)} className="form-control" id="exampleInputPassword1" />
      </div>
      <div className="mb-3">
        <label htmlFor="exampleInputPassword1" className="form-label">image</label>
        <input type="file" onChange={(e) => setImage(e.target.files[0])} className="form-control" id="exampleInputPassword1" />
      </div>
      <div className="mb-3">
        <label htmlFor="exampleInputPassword1" className="form-label">School Name</label>
        <input type="text" value={school} onChange={(e) => setSchool(e.target.value)} className="form-control" id="exampleInputPassword1" />
      </div>
      <div className="mb-3">
        <label htmlFor="exampleInputPassword1" className="form-label">Grade(Class)</label>
        <input type="text" value={grade} onChange={(e) => setGrade(e.target.value)} className="form-control" id="exampleInputPassword1" />
      </div>
      <div className="mb-3">
        <label htmlFor="exampleInputPassword1" className="form-label">Any Extra Information</label>
        <input type="text" value={Extra} onChange={(e) => setExtra(e.target.value)} className="form-control" id="exampleInputPassword1" />
      </div>

      <button type="submit " className="btn btn-primary d-flex mx-auto" style=>Submit</button>
    </form>
  </div>
)

}

Laravel API
public function store(Request $request){


  $product = new product;
   $product->category_id = $request->category_id;
   $product->product_name = $request->product_name;
   $product->product_image = $request->file('image')->store('p_imges');
     $product->product_quantity = $request->product_quantity;
     $product->product_price = $request->product_price;
   $product->product_auther = $request->product_auther;
   $product->class = $request->class;
   $product->school_name = $request->school_name;
   $product->gender = $request->gender;
   $product->F_xyz = $request->F_xyz;
   $product->size = $request->size;
   $product->xtra_info = $request->xtra_info;
    $product->doner_id = Auth::id();
    $product->save();
    $product = ["Product Successfully Added"];
    return $product;

}

Error This error occur



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

Laravel Project setup - failed to open stream: No such file or directory

file_put_contents(C:\xampp\htdocs\crmdemo\storage\framework/sessions/25qFABodcItYp2P122Qr0CFPq0fjXUGOHJLKuFqY): failed to open stream: No such file or directory

I tried all methods and degrade the php and composer version. But not working for this setup. Please guide to properly setup for me.



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

jeudi 8 septembre 2022

WhereIn Insinde Where array - Laravel Query Builder

I'm trying use a whereIn inside a where array I am passing to Laravel query Builder:


$where = [['Participants.Client_Id','IN', $clientId]];

DB::table('Participants')->where($where)->get()

Something like is what I want to achieve, and I know there are works around such as using whereIn, but I'm sharing here a small piece of code to give you an idea, so I need to change the array to make it works as a whereIn, not changing the ->where to ->whereIn or ->whereRaw



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

mercredi 7 septembre 2022

Can't download files from public folder from Laravel 5.6

I don't know what I am doing wrong here, but I can't for the life of me manage to get the download feature to work in Laravel 5.6

I have files saved to the public folder as you can see below:

enter image description here

On the webpage, these images show up correctly in HTML <img> tags and when I view the details of the image, it shows me that it points to https://mydomain.test/storage/LIizYnRWEqYOgTPlzTxbmuSbTMNYIFrnjLP1YWVH.png.

However, when I try and download this file from the server, I constantly get an exception error about the file not existing (for example: "data":"The file \"public\/LIizYnRWEqYOgTPlzTxbmuSbTMNYIFrnjLP1YWVH.png\" does not exist"). I have tried every combination of path string I can think of, but everything results in the same error.

I have tried using storage_path, I have tried using the original path, I've tried hard coding the path

    [2022-09-08 09:58:55] local.ERROR: Failed to download media file: The file "/home/vagrant/Code/dras/storage/LIizYnRWEqYOgTPlzTxbmuSbTMNYIFrnjLP1YWVH.png" does not exist  
    [2022-09-08 09:59:38] local.ERROR: Failed to download media file: The file "public/LIizYnRWEqYOgTPlzTxbmuSbTMNYIFrnjLP1YWVH.png" does not exist  
    [2022-09-08 10:00:14] local.ERROR: Failed to download media file: The file "https://mydomain.test/storage/LIizYnRWEqYOgTPlzTxbmuSbTMNYIFrnjLP1YWVH.png" does not exist   
    [2022-09-08 10:17:18] local.ERROR: Failed to download media file: The file "app/public/LIizYnRWEqYOgTPlzTxbmuSbTMNYIFrnjLP1YWVH.png" does not exist
    [2022-09-08 10:45:50] local.ERROR: Failed to download media file: The file "storage/public/LIizYnRWEqYOgTPlzTxbmuSbTMNYIFrnjLP1YWVH.png" does not exist 

The only combination that doesn't throw an exception about "file does not exist" is when I use the path

return response()->download( 'storage/LIizYnRWEqYOgTPlzTxbmuSbTMNYIFrnjLP1YWVH.png' );

However, that command throws a totally different error:

Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Symfony\Component\HttpFoundation\BinaryFileResponse::header() in file /home/vagrant/Code/dras/app/Http/Middleware/Cors.php on line 27



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

Stripe differentiate between payment Intent and payment link

I'm trying to read the webhook response from both a payment intent (in which a user in the website press pay to pay for an item) and a payment link (where he receives a link which then he can pay through) I'm trying to find how can I differentiate between them but I can't find a difference. Is there a flag or something to distinguish which one was paid



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

mardi 6 septembre 2022

Laravel wait for a specific queued listener to finish then return

I have an Event with a bunch of queued listeners. Can't run sync because I am calling external APIs etc

Events\Invoice\InvoiceEvent::class => [
    Listeners\Invoice\Listener1::class, 
    Listeners\Invoice\Listener2::class,
    Listeners\Invoice\Listener3::class, // calling external APIs
    Listeners\Invoice\Listener4::class,
    Listeners\Invoice\Listener5::class,
],

Calling this event from a controller method.

public function store(Request $request)
{
    $invoice = Invoice::findOrFail($request->id);
    InvoiceEvent::dispatch($invoice); // Async event, it cannot be sync

    return $invoice; // need to return only when Listener3 finish execution
}

return $invoice is dependent on Listener3, otherwise, it will return incomplete data.

How can I return only when Listener3 is finished executing?

I came up with sleep(10); but it's not an ideal solution.

Listener3 saves data from third-party API to the invoices table which needs to be returned, that's why cannot return incomplete invoice data, right now the required data gets added to the invoice but after its return



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

lundi 5 septembre 2022

i want to read my emails(Gmail) on my Laravel app i tried to use IMAP but I don't understand because i am a beginner in laravel

I am not sure about which method to use to read emails on my app and I have been stuck on this thing for 5 days and still not getting any response. I have read about https://github.com/barbushin/php-imap

but still, I have no clue how to proceed. Thank you!



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

dimanche 4 septembre 2022

hi! help me out laravel devs in this query below [closed]

hope so you are doing great.

what topics to cover in PHP before shifting to the framework.

cheers.

give the answer in the best and precise way thank you



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

Laravel ffmpeg failed to execute command

I'm using protonemedia/laravel-ffmpeg package everything works fine on localhost but on the live server, there is an error message shown.

ProtoneMedia\ LaravelFFMpeg\ Exporters\ EncodingException

ffmpeg failed to execute command '/usr/bin/ffmpeg' '-y' '-threads' '12' '-i' '/www/wwwroot/hamza/storage/app/upload/videos/uofH50IWXt3Doqacxkd2tATboUT5gLfVGaAWyvsS.mp4' '-map' '0' '-vcodec' 'libx264' '-b:v' '1000k' '-sc_threshold' '0' '-g' '48' '-hls_playlist_type' 'vod' '-hls_time' '10' '-hls_segment_filename' '/www/wwwroot/hamza/storage/app/streamable_videos/21_0_1000_%05d.ts' '-master_pl_name' 'temporary_segment_playlist_0.m3u8' '-acodec' 'aac' '-b:a' '128k' '/www/wwwroot/hamza/storage/app/streamable_videos/21_0_1000.m3u8': Error Output: ffmpeg version 3.4.11 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-44) configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro ' --extra-cflags=' ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcdio --enable-libdrm --enable-indev=jack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopus --disable-encoder=libopus --enable-libpulse --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzvbi --enable-avfilter --enable-avresample --enable-libmodplug --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-libmfx --enable-runtime-cpudetect libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Unrecognized option 'master_pl_name'. Error splitting the argument list: Option not found

I'm using a job to do conversation

ConvertVideoForStreaming.php Job:

<?php

namespace App\Jobs;
set_time_limit(60000);

use FFMpeg;
use Carbon\Carbon;
use App\Models\Video;
use FFMpeg\Format\Video\X264;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Storage;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

class ConvertVideoForStreaming implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public $video;

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

    public function handle()
    {
        // create some video formats...
        $lowBitrateFormat  = (new X264)->setKiloBitrate(500);
        $highBitrateFormat = (new X264)->setKiloBitrate(3000);

        // open the uploaded video from the right disk...
        FFMpeg::fromDisk($this->video->disk)
            ->open($this->video->path)

            // call the 'exportForHLS' method and specify the disk to which we want to export...
            ->exportForHLS()
            ->withRotatingEncryptionKey(function ($filename, $contents) {
                Storage::disk('streamable_keys')->put($filename, $contents);
            })
            // we'll add different formats so the stream will play smoothly
            // with all kinds of internet connections...
            ->addFormat($lowBitrateFormat)
            ->addFormat($highBitrateFormat)

            // call the 'save' method with a filename...
            ->toDisk('streamable_videos')
            ->save($this->video->id . '.m3u8');

        // update the database so we know the convertion is done!
        $this->video->update([
            'converted_for_streaming_at' => Carbon::now(),
        ]);
    }
}

I'm storing the key at custom disk "streamable_keys", and converted videos should be stored in "streamable_videos".

the streamable keys are generated and saved to a directory without any issues, but streamable videos are not saved to the directory.

after some tracks I found that the problem happens in this line of code:

        ->save($this->video->id . '.m3u8');

all the lines before that line work perfectly.

any ideas on how to fix that?

Full error screenshot

ConvertVideoForStreaming.php



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

samedi 3 septembre 2022

Is their any way to practice back-end? [closed]

How can I practice back-end? Is there any website where I can find front-end and attach back-end by my-self?



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

vendredi 2 septembre 2022

i use this function but it give me table empty

public function view_details_vide($vide){

    $ets = DB::table('dossier')->leftJoin('rfi', function ($join) {
        $join->on('dossier.code_dossier', '=', 'rfi.code_do');})->leftJoin('rfq', function ($join) {
            $join->on('dossier.code_dossier', '=', 'rfq.code');})->whereNull('rfi.RFI_statut','=',$vide)->orderBy('date_activation','DESC')->first();
     return view('/admin/accueil',['ets'=>$ets]);
}


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

i want to move the images to another directory if the status of the image is 1(active) i am able to move one record but not all

I want a simple guide on how can i transfer the images with active status to another directory here is my code:

Route::get('/', function () {
$path = public_path('images\products');
$allfiles = scandir($path);
$allfiles = array_diff(scandir($path), array('.', '..'));
$files = array();

foreach ($allfiles as $filename) {
    $file= File::get(public_path('images/products/'.$filename));}
    $files[] = [
        "file_name"=>$filename];
        // return $files;
            // return $files;

foreach($files as $file){
    $users = DB::table('tw_products')
    ->where('status', '=', 1)

    ->get('image') ;
if($users = $file['file_name']){
File::copy('images/products/'.$file['file_name'],'images/ActiveProducts/'.$file['file_name']);
    echo "File Moved";
  }
 }
  });

I want to compare the DB items(image and status) if the status of the image = 1 that image will be moved to another directory... I am doing some mistakes i am able to move 1 last product but others are not moving



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

jeudi 1 septembre 2022

laravel5.7 login not working on aws ec2 instance

Code is working from last 3 years, but suddenly login or any other request are not working it redirects me to default page without error message. Same code is working on another server but on aws its misbehaving.

Note - Session is stored in database.

Users are stuck and chasing continuously. Any help would be highly appreciated.



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

I want to read all my received emails and download the attachments in the mail from Gmail through Laravel. I don't want to send email is it possible?

I am working on a project in which I want to read the recieved mails from my gmail account/ or basically i want that attachment linked in a mail i want to downlownload that attachment through my laravel app is it possible if it is then let me know the method how can i do that ....in simple words my task is to get the attachment from the mails and save it in my directory... Thank you for your time!

MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"


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