• 0

حل مشكلة Failed: App\Jobs\CompanyMail في laravel jobs queue

السلام عليكم 

عند تنفيذ الامر php artisan queue:work يظهر هذا الخطئ

[2021-08-23 15:03:47][4] Processing: App\Jobs\CompanyMail
[2021-08-23 15:04:00][4] Failed:     App\Jobs\CompanyMail

 

هذا كود ال controller

public function storemail(Request $request)
    {
        $request->validate([
            'title' => 'required',
            'message' => 'required',
        ]);
        $details = [
            'title' => $request->input('title'),
            'message' => $request->input('message')
        ];
        $job = (new  CompanyMail($details));
        dispatch($job);
        return redirect()->back()->with('message', 'mail have successfully sent');
    }

 هذا كود ال job

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

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $emails = Email::all();
        $input['title'] = $this->details['title'];
        $input['message'] = $this->details['message'];
        foreach ($emails as $email) {
            $input['email'] = $email->email;

            Mail::send('email.CompanyMail', ['input' => $input], function ($message) use ($input) {
                $message->to($input['email'])->subject($input['title']);
            });
        }
    }

هذا كود ال route

Route::post('/send-mail', [EmailController::class, 'storemail']);

هذا كود ال email html 

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Email</title>
</head>

<body>
    <h1>Welcome to our K.I.B.S Company</h1>
    <p>{{$input['message']}}</p>
    <p>Thanks for the subscription for newsletter where you can still updated for the lateset news and events for our company.</p>

    <button>Sign up</button>
    <footer>
        <div class="mt-10 bottom-0 text-center py-10">
            <h4 class="text-sm font-semibold text-gray-600 "> &COPY; 2021 K.I.B.S</h4>
        </div>
    </footer>
</body>

</html>

 لم اعرف سبب الخطئ؟؟؟؟

بتاريخ 4 ساعات قال Mohammad Kiblawi:

السلام عليكم 

عند تنفيذ الامر php artisan queue:work يظهر هذا الخطئ

[2021-08-23 15:03:47][4] Processing: App\Jobs\CompanyMail
[2021-08-23 15:04:00][4] Failed:     App\Jobs\CompanyMail

 

هذا كود ال controller


public function storemail(Request $request)
    {
        $request->validate([
            'title' => 'required',
            'message' => 'required',
        ]);
        $details = [
            'title' => $request->input('title'),
            'message' => $request->input('message')
        ];
        $job = (new  CompanyMail($details));
        dispatch($job);
        return redirect()->back()->with('message', 'mail have successfully sent');
    }

 هذا كود ال job


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

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $emails = Email::all();
        $input['title'] = $this->details['title'];
        $input['message'] = $this->details['message'];
        foreach ($emails as $email) {
            $input['email'] = $email->email;

            Mail::send('email.CompanyMail', ['input' => $input], function ($message) use ($input) {
                $message->to($input['email'])->subject($input['title']);
            });
        }
    }

هذا كود ال route


Route::post('/send-mail', [EmailController::class, 'storemail']);

هذا كود ال email html 


<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Email</title>
</head>

<body>
    <h1>Welcome to our K.I.B.S Company</h1>
    <p>{{$input['message']}}</p>
    <p>Thanks for the subscription for newsletter where you can still updated for the lateset news and events for our company.</p>

    <button>Sign up</button>
    <footer>
        <div class="mt-10 bottom-0 text-center py-10">
            <h4 class="text-sm font-semibold text-gray-600 "> &COPY; 2021 K.I.B.S</h4>
        </div>
    </footer>
</body>

</html>

 لم اعرف سبب الخطئ؟؟؟؟

عذرا منكم لقد حلت المشكلة

 

شكرا لكم

Annotation 2021-08-23 224056.png

تمّ تعديل بواسطة Wael Aljamal
توضيح السؤال
1 شخص أعجب بهذا

انشر على الشّبكات الاجتماعية


رابط هذه المساهمة
شارك على الشبكات الإجتماعية
  • 0

قم بالدخول إلى الجدول failed_jobs في قاعدة البيانات، ستجد هناك سطر فيه العمل الخاطئ
في العمود exception ستجد نص الخطأ أضفه هنا لأتمكن من مساعدتك

انشر على الشّبكات الاجتماعية


رابط هذه المساهمة
شارك على الشبكات الإجتماعية
  • 0
بتاريخ 1 دقيقة مضت قال Hassan Hedr:

قم بالدخول إلى الجدول failed_jobs في قاعدة البيانات، ستجد هناك سطر فيه العمل الخاطئ
في العمود exception ستجد نص الخطأ أضفه هنا لأتمكن من مساعدتك

اعتقد انه حلت المشكلة 

هذا نص ال exeption

ErrorException: Trying to access array offset on value of type null in D:\hasoub\Backend project\Company_Project\app\Jobs\CompanyMail.php:37
Stack trace:
#0 D:\hasoub\Backend project\Company_Project\app\Jobs\CompanyMail.php(37): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Trying to acces...', 'D:\\hasoub\\Backe...', 37, Array)
#1 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(36): App\Jobs\CompanyMail->handle()
#2 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Container\Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#3 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#4 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#5 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Container\Container.php(651): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#6 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Bus\Dispatcher.php(128): Illuminate\Container\Container->call(Array)
#7 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(App\Jobs\CompanyMail))
#8 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(App\Jobs\CompanyMail))
#9 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Bus\Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#10 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(120): Illuminate\Bus\Dispatcher->dispatchNow(Object(App\Jobs\CompanyMail), false)
#11 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(128): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}(Object(App\Jobs\CompanyMail))
#12 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(App\Jobs\CompanyMail))
#13 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(122): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#14 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(70): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware(Object(Illuminate\Queue\Jobs\DatabaseJob), Object(App\Jobs\CompanyMail))
#15 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Queue\Jobs\Job.php(98): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array)
#16 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(428): Illuminate\Queue\Jobs\Job->fire()
#17 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(378): Illuminate\Queue\Worker->process('database', Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions))
#18 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(172): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\DatabaseJob), 'database', Object(Illuminate\Queue\WorkerOptions))
#19 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(117): Illuminate\Queue\Worker->daemon('database', 'default', Object(Illuminate\Queue\WorkerOptions))
#20 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(101): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'default')
#21 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()
#22 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Container\Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#23 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#24 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#25 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Container\Container.php(651): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#26 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Console\Command.php(136): Illuminate\Container\Container->call(Array)
#27 D:\hasoub\Backend project\Company_Project\vendor\symfony\console\Command\Command.php(299): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#28 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Console\Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#29 D:\hasoub\Backend project\Company_Project\vendor\symfony\console\Application.php(978): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 D:\hasoub\Backend project\Company_Project\vendor\symfony\console\Application.php(295): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 D:\hasoub\Backend project\Company_Project\vendor\symfony\console\Application.php(167): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Console\Application.php(92): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#33 D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(129): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#34 D:\hasoub\Backend project\Company_Project\artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#35 {main}

لدي استفسار كيف يكمنني تقسيم الjob الى عدد محدد 

اي اريد ارسال 25 email على مثال 500 user اي ان هنالك 20 job

 

1 شخص أعجب بهذا

انشر على الشّبكات الاجتماعية


رابط هذه المساهمة
شارك على الشبكات الإجتماعية
  • 0
بتاريخ 14 دقائق مضت قال Mohammad Kiblawi:

لدي استفسار كيف يكمنني تقسيم الjob الى عدد محدد 

اي اريد ارسال 25 email على مثال 500 user اي ان هنالك 20 job

يمكن تمرير حزمة الايميلات التي تريد الارسال لها إلى ComanyMail كالتالي

class CompanyMail implements ShouldQueue
{

  public $details;
  public $emails;

  public function __construct($details, $emails)
  {
    $this->details = $details;
    $this->emails = $emails;
  }

  public function handle()
  {
    // إرسال البريد الإلكتروني إلى حزمة البريد الالكتروني المحددة أو للجميع

    $emails = $this->emails ?? Email::all();
    $input['title'] = $this->details['title'];
    $input['message'] = $this->details['message'];
    foreach ($emails as $email) {
      $input['email'] = $email->email;

      Mail::send(
        'email.CompanyMail',
        ['input' => $input],
        function ($message) use ($input) {
          $message->to($input['email'])->subject($input['title']);
        }
      );
    }
  }
}

 وتقوم بتقسيم الحزمة وتمريرها الى عدة نسخ من العمل نفسه داخل ال Controller كالتالي

  public function storemail(Request $request)
  {
    $request->validate([
      'title' => 'required',
      'message' => 'required',
    ]);
    $details = [
      'title' => $request->input('title'),
      'message' => $request->input('message')
    ];

    // نقسم النتيجة الى دفعات وننشئ عملا لكل منها

    Email::chunk(25, function ($emails) use ($details) {
      dispatch(new  CompanyMail($details, $emails));
    });


    return redirect()->back()->with('message', 'mail have successfully sent');
  }
1 شخص أعجب بهذا

انشر على الشّبكات الاجتماعية


رابط هذه المساهمة
شارك على الشبكات الإجتماعية
  • 0
PS D:\hasoub\Backend project\Company_Project> php artisan db:seed 
Seeding: Database\Seeders\EmailSeeder

   Illuminate\Database\QueryException 

  SQLSTATE[HY000]: General error: 1364 Field 'title' doesn't have a default value (SQL: insert into `emails` (`email`, `updated_at`, `created_at`) values (ckohler@example.net, 2021-08-23 20:06:40, 2021-08-23 20:06:40))

  at D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Database\Connection.php:692
    688▕         // If an exception occurs when attempting to run a query, we'll format the error
    689         // message to include the bindings with SQL, which will make this exception a
    690         // lot more helpful to the developer instead of just the database's errors.
    691         catch (Exception $e) {
   692             throw new QueryException(
    693                 $query, $this->prepareBindings($bindings), $e
    694             );
    695         }
    696     }

  1   D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Database\Connection.php:485

  2   D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Database\Connection.php:485
      PDOStatement::execute()
PS D:\hasoub\Backend project\Company_Project> php artisan db:seed
Seeding: Database\Seeders\EmailSeeder

   Illuminate\Database\QueryException 

  SQLSTATE[HY000]: General error: 1364 Field 'title' doesn't have a default value (SQL: insert into `emails` (`email`, `updated_at`, `created_at`) values (emilia09@example.net, 2021-08-23 20:08:45, 2021-08-23 20:08:45))

  at D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Database\Connection.php:692
    688▕         // If an exception occurs when attempting to run a query, we'll format the error
    689         // message to include the bindings with SQL, which will make this exception a
    690         // lot more helpful to the developer instead of just the database's errors.
    691         catch (Exception $e) {
   692             throw new QueryException(
    693                 $query, $this->prepareBindings($bindings), $e
    694             );
    695         }
    696     }

  1   D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Database\Connection.php:485
      PDOException::("SQLSTATE[HY000]: General error: 1364 Field 'title' doesn't have a default value")

  2   D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Database\Connection.php:485
      PDOStatement::execute()
PS D:\hasoub\Backend project\Company_Project> 

ظهر لي هذا الخطئ عندما كتبت الامر php artisan db:seed

هذا ال seeder الخاص بال email 

<?php

namespace Database\Seeders;

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

class EmailSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Email::factory()
            ->times(100)
            ->create();
    }
}

و هذا المصنع الخاص بال emails

 

<?php

namespace Database\Factories;

use App\Models\email;
use Illuminate\Database\Eloquent\Factories\Factory;

class EmailFactory extends Factory
{
    /**
     * The name of the factory's corresponding model.
     *
     * @var string
     */
    protected $model = email::class;

    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {
        return [
            'email' => $this->faker->unique()->safeEmail(),
        ];
    }
}

 

 

و هذا ال database seeder

 

<?php

namespace Database\Seeders;

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

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run()
    {
        // \App\Models\User::factory(10)->create();
        User::factory()
            ->times(50)
            ->create();
        $this->call(EmailSeeder::class);
    }
}

 

انشر على الشّبكات الاجتماعية


رابط هذه المساهمة
شارك على الشبكات الإجتماعية
  • 0
بتاريخ 1 دقيقة مضت قال Mohammad Kiblawi:

PS D:\hasoub\Backend project\Company_Project> php artisan db:seed 
Seeding: Database\Seeders\EmailSeeder

   Illuminate\Database\QueryException 

  SQLSTATE[HY000]: General error: 1364 Field 'title' doesn't have a default value (SQL: insert into `emails` (`email`, `updated_at`, `created_at`) values (ckohler@example.net, 2021-08-23 20:06:40, 2021-08-23 20:06:40))

  at D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Database\Connection.php:692
    688▕         // If an exception occurs when attempting to run a query, we'll format the error
    689         // message to include the bindings with SQL, which will make this exception a
    690         // lot more helpful to the developer instead of just the database's errors.
    691         catch (Exception $e) {
   692             throw new QueryException(
    693                 $query, $this->prepareBindings($bindings), $e
    694             );
    695         }
    696     }

  1   D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Database\Connection.php:485

  2   D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Database\Connection.php:485
      PDOStatement::execute()
PS D:\hasoub\Backend project\Company_Project> php artisan db:seed
Seeding: Database\Seeders\EmailSeeder

   Illuminate\Database\QueryException 

  SQLSTATE[HY000]: General error: 1364 Field 'title' doesn't have a default value (SQL: insert into `emails` (`email`, `updated_at`, `created_at`) values (emilia09@example.net, 2021-08-23 20:08:45, 2021-08-23 20:08:45))

  at D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Database\Connection.php:692
    688▕         // If an exception occurs when attempting to run a query, we'll format the error
    689         // message to include the bindings with SQL, which will make this exception a
    690         // lot more helpful to the developer instead of just the database's errors.
    691         catch (Exception $e) {
   692             throw new QueryException(
    693                 $query, $this->prepareBindings($bindings), $e
    694             );
    695         }
    696     }

  1   D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Database\Connection.php:485
      PDOException::("SQLSTATE[HY000]: General error: 1364 Field 'title' doesn't have a default value")

  2   D:\hasoub\Backend project\Company_Project\vendor\laravel\framework\src\Illuminate\Database\Connection.php:485
      PDOStatement::execute()
PS D:\hasoub\Backend project\Company_Project> 

ظهر لي هذا الخطئ عندما كتبت الامر php artisan db:seed

هذا ال seeder الخاص بال email 


<?php

namespace Database\Seeders;

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

class EmailSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Email::factory()
            ->times(100)
            ->create();
    }
}

و هذا المصنع الخاص بال emails

 


<?php

namespace Database\Factories;

use App\Models\email;
use Illuminate\Database\Eloquent\Factories\Factory;

class EmailFactory extends Factory
{
    /**
     * The name of the factory's corresponding model.
     *
     * @var string
     */
    protected $model = email::class;

    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {
        return [
            'email' => $this->faker->unique()->safeEmail(),
        ];
    }
}

 

 

و هذا ال database seeder

 


<?php

namespace Database\Seeders;

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

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run()
    {
        // \App\Models\User::factory(10)->create();
        User::factory()
            ->times(50)
            ->create();
        $this->call(EmailSeeder::class);
    }
}

 

الخاصية title في قاعدة البيانات لا يمكن أن تكون Null الحل:

  • إما أن تسمح بالقيمة Null من قاعدة البيانات لها
  • أو أن تضع لها قيمة افتراضية في المصنع كالتالي:
class EmailFactory extends Factory
{
    /**
     * The name of the factory's corresponding model.
     *
     * @var string
     */
    protected $model = email::class;

    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {
        return [
		'email' => $this->faker->unique()->safeEmail(),
		'title' => $this->faker->sentence(), // قيمة افتراضية
        ];
    }
}

 

1 شخص أعجب بهذا

انشر على الشّبكات الاجتماعية


رابط هذه المساهمة
شارك على الشبكات الإجتماعية
  • 0

عند تشغيل التطبيق على منصة heroku و اريد ان انشر المشاريع (cards) لا تظهر الصور 

لماذا يا ترى؟؟

Annotation 2021-08-24 001057.png

انشر على الشّبكات الاجتماعية


رابط هذه المساهمة
شارك على الشبكات الإجتماعية
  • 0
بتاريخ 12 دقائق مضت قال Mohammad Kiblawi:

عند تشغيل التطبيق على منصة heroku و اريد ان انشر المشاريع (cards) لا تظهر الصور 

لماذا يا ترى؟؟

Annotation 2021-08-24 001057.png

 

جرب الضغط باليمين على الصورة واختيار "Open image in new tab" وملاحظة ال URL للصفحة الجديدة من أين مصدر الصورة
1 شخص أعجب بهذا

انشر على الشّبكات الاجتماعية


رابط هذه المساهمة
شارك على الشبكات الإجتماعية
  • 0
بتاريخ 15 دقائق مضت قال Mohammad Kiblawi:

عند تشغيل التطبيق على منصة heroku و اريد ان انشر المشاريع (cards) لا تظهر الصور 

سبب ذلك عدم ربط المجلد storage مع المجلد public عليك تنفيذ الأمر:

php artisan storage:link

وتأكد أن سواقة التخزين هي public في env.

1 شخص أعجب بهذا

انشر على الشّبكات الاجتماعية


رابط هذه المساهمة
شارك على الشبكات الإجتماعية
  • 0
بتاريخ 4 دقائق مضت قال Wael Aljamal:

سبب ذلك عدم ربط المجلد storage مع المجلد public عليك تنفيذ الأمر:


php artisan storage:link

وتأكد أن سواقة التخزين هي public في env.

تقصد filesystem_driver الموجود في env؟ 

انشر على الشّبكات الاجتماعية


رابط هذه المساهمة
شارك على الشبكات الإجتماعية
  • 0
بتاريخ الآن قال Mohammad Kiblawi:

تقصد filesystem_driver الموجود في env؟ 

نعم إن كانت الصور على استضافة هيروكو أي public يجب ضبط البيئة بطريقة صحيحة

1 شخص أعجب بهذا

انشر على الشّبكات الاجتماعية


رابط هذه المساهمة
شارك على الشبكات الإجتماعية
  • 0

لكن ملف env غير موجود على github بل هو مخفي

كيف يمكنني رؤيته؟

حتى ارسال البريد الالكتروني لا يعمل و اظهر exeption

Swift_TransportException: Expected response code 250 but got code "550", with message "550 5.7.1 Relaying denied" in /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:459Stack trace:#0 /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(344): Swift_Transport_AbstractSmtpTransport->assertResponseCode()#1 /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php(305): Swift_Transport_AbstractSmtpTransport->executeCommand()#2 /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(392): Swift_Transport_EsmtpTransport->executeCommand()#3 /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(499): Swift_Transport_AbstractSmtpTransport->doDataCommand()#4 /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(518): Swift_Transport_AbstractSmtpTransport->doMailTransaction()#5 /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(206): Swift_Transport_AbstractSmtpTransport->sendTo()#6 /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php(71): Swift_Transport_AbstractSmtpTransport->send()#7 /app/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(521): Swift_Mailer->send()#8 /app/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(288): Illuminate\Mail\Mailer->sendSwiftMessage()#9 /app/vendor/laravel/framework/src/Illuminate/Mail/MailManager.php(521): Illuminate\Mail\Mailer->send()#10 /app/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\Mail\MailManager->__call()#11 /app/app/Jobs/CompanyMail.php(54): Illuminate\Support\Facades\Facade::__callStatic()#12 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Jobs\CompanyMail->handle()#13 /app/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()#14 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()#15 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()#16 /app/vendor/laravel/framework/src/Illuminate/Container/Container.php(651): Illuminate\Container\BoundMethod::call()#17 /app/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\Container\Container->call()#18 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}()#19 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()#20 /app/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then()#21 /app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(120): Illuminate\Bus\Dispatcher->dispatchNow()#22 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}()#23 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()#24 /app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(122): Illuminate\Pipeline\Pipeline->then()#25 /app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware()#26 /app/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\Queue\CallQueuedHandler->call()#27 /app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(428): Illuminate\Queue\Jobs\Job->fire()#28 /app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(378): Illuminate\Queue\Worker->process()#29 /app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(172): Illuminate\Queue\Worker->runJob()#30 /app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(117): Illuminate\Queue\Worker->daemon()#31 /app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\Queue\Console\WorkCommand->runWorker()#32 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()#33 /app/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()#34 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()#35 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()#36 /app/vendor/laravel/framework/src/Illuminate/Container/Container.php(651): Illuminate\Container\BoundMethod::call()#37 /app/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call()#38 /app/vendor/symfony/console/Command/Command.php(299): Illuminate\Console\Command->execute()#39 /app/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run()#40 /app/vendor/symfony/console/Application.php(978): Illuminate\Console\Command->run()#41 /app/vendor/symfony/console/Application.php(295): Symfony\Component\Console\Application->doRunCommand()#42 /app/vendor/symfony/console/Application.php(167): Symfony\Component\Console\Application->doRun()#43 /app/vendor/laravel/framework/src/Illuminate/Console/Application.php(92): Symfony\Component\Console\Application->run()#44 /app/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run()#45 /app/artisan(37): Illuminate\Foundation\Console\Kernel->handle()#46 {main}

 

تمّ تعديل بواسطة Mohammad Kiblawi
تعديل

انشر على الشّبكات الاجتماعية


رابط هذه المساهمة
شارك على الشبكات الإجتماعية
  • 0
بتاريخ 9 دقائق مضت قال Mohammad Kiblawi:

لكن ملف env غير موجود على github بل هو مخفي

حتى هيروكو له ملف env خاص به، يمكنك الدخول للوحة تحكم تطبيقك و إضافة متغيرات البيئة يدوياً:

dashboard.heroku.com

يمكنك اتباع التوثيقين لإضافة بيانات البيئة:

  1. heroku-local
  2. config-vars
1 شخص أعجب بهذا

انشر على الشّبكات الاجتماعية


رابط هذه المساهمة
شارك على الشبكات الإجتماعية
  • 0
بتاريخ 12 دقائق مضت قال Mohammad Kiblawi:

حتى ارسال البريد الالكتروني لا يعمل و اظهر exeption


Swift_TransportException: Expected response code 250 but got code "550", with message "550 5.7.1 Relaying denied" in /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:459Stack trace:#0 /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(344): Swift_Transport_AbstractSmtpTransport->assertResponseCode()#1 /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php(305): Swift_Transport_AbstractSmtpTransport->executeCommand()#2 /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(392): Swift_Transport_EsmtpTransport->executeCommand()#3 /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(499): Swift_Transport_AbstractSmtpTransport->doDataCommand()#4 /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(518): Swift_Transport_AbstractSmtpTransport->doMailTransaction()#5 /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(206): Swift_Transport_AbstractSmtpTransport->sendTo()#6 /app/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php(71): Swift_Transport_AbstractSmtpTransport->send()#7 /app/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(521): Swift_Mailer->send()#8 /app/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(288): Illuminate\Mail\Mailer->sendSwiftMessage()#9 /app/vendor/laravel/framework/src/Illuminate/Mail/MailManager.php(521): Illuminate\Mail\Mailer->send()#10 /app/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\Mail\MailManager->__call()#11 /app/app/Jobs/CompanyMail.php(54): Illuminate\Support\Facades\Facade::__callStatic()#12 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Jobs\CompanyMail->handle()#13 /app/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()#14 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()#15 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()#16 /app/vendor/laravel/framework/src/Illuminate/Container/Container.php(651): Illuminate\Container\BoundMethod::call()#17 /app/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\Container\Container->call()#18 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}()#19 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()#20 /app/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then()#21 /app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(120): Illuminate\Bus\Dispatcher->dispatchNow()#22 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}()#23 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()#24 /app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(122): Illuminate\Pipeline\Pipeline->then()#25 /app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware()#26 /app/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\Queue\CallQueuedHandler->call()#27 /app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(428): Illuminate\Queue\Jobs\Job->fire()#28 /app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(378): Illuminate\Queue\Worker->process()#29 /app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(172): Illuminate\Queue\Worker->runJob()#30 /app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(117): Illuminate\Queue\Worker->daemon()#31 /app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\Queue\Console\WorkCommand->runWorker()#32 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()#33 /app/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()#34 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()#35 /app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()#36 /app/vendor/laravel/framework/src/Illuminate/Container/Container.php(651): Illuminate\Container\BoundMethod::call()#37 /app/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call()#38 /app/vendor/symfony/console/Command/Command.php(299): Illuminate\Console\Command->execute()#39 /app/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run()#40 /app/vendor/symfony/console/Application.php(978): Illuminate\Console\Command->run()#41 /app/vendor/symfony/console/Application.php(295): Symfony\Component\Console\Application->doRunCommand()#42 /app/vendor/symfony/console/Application.php(167): Symfony\Component\Console\Application->doRun()#43 /app/vendor/laravel/framework/src/Illuminate/Console/Application.php(92): Symfony\Component\Console\Application->run()#44 /app/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run()#45 /app/artisan(37): Illuminate\Foundation\Console\Kernel->handle()#46 {main}

 

تأكد من تعيين القيمة الصحيحة لـ MAIL_DRIVER داخل ملف .env

انشر على الشّبكات الاجتماعية


رابط هذه المساهمة
شارك على الشبكات الإجتماعية

يجب أن تكون عضوًا لدينا لتتمكّن من التعليق

انشاء حساب جديد

يستغرق التسجيل بضع ثوان فقط


سجّل حسابًا جديدًا

تسجيل الدخول

تملك حسابا مسجّلا بالفعل؟


سجّل دخولك الآن