اذهب إلى المحتوى

Mahmoud Alrashidi

الأعضاء
  • المساهمات

    104
  • تاريخ الانضمام

  • تاريخ آخر زيارة

كل منشورات العضو Mahmoud Alrashidi

  1. قمت بتثبيت حزمة barryvdh/laravel-dompdf و هي تعمل في هذا المثال: Route::get('/pdf', function() { $pdf = App::make('dompdf.wrapper'); $pdf->loadHTML('<h1>Test</h1>'); return $pdf->download('invoice.pdf'); }); لكن عندما أستخدم صفحة العرض الخاصة بي التي بها حلقة: Route::get('/pdf', function() { //ini_set('max_execution_time', 120); // هذا ايضاً لا يحل المشكل $displaysales = \App\sales::paginate(3); $pdf = PDF::loadView('salestable', array('displaysales' => $displaysales)); return $pdf->download('lala.pdf'); }); رسالة الخطأ كالتالي: FatalErrorException in Helpers.php line 432: Maximum execution time of 60 seconds exceeded in Helpers.php line 432 أستخدم ملف تنسيقات خارجي في صفحة العرض: <link rel="stylesheet" href='{{ asset("assets/stylesheets/styles.css") }}' />
  2. لقد قمت للتو بالترقية إلى PHP 8.0.1 و Lavavel 8 من PHP 5.6 و Laravel 5.3. لقد قمت بتضمين قسم يتطلب ملف composer.json ؛ "laravel/ui": "^3.0" تم تثبيته في مجلد vendor. عندما أقوم بتنفيذ الأمر: php artisan ui vue --auth يعطيني الخطأ التالي: Command "ui" is not defined ماهو حل المشكلة.
  3. أنا أبحث عن إمكانية الحصول على قائمة بالمستخدمين بما في ذلك الحد الأقصى لسعر المقالة لكل مستخدم. إذا فعلت ذلك على هذا النحو ، فهو يعمل: $users=User::withMax('articles','price')->get(); ومع ذلك ، أريد فقط النظر في المقالات النشطة ، لذلك أفكر في القيام بشيء من هذا القبيل ، لكن هذا فشل $users=User::withMax('articles','price')->where('articles.active',true)->get(); عندما أنظر إلى طلب البحث الفرعي الذي تم إنشاؤه ، يتضح سبب فشله: select `users`.* (select max(`articles`.`price`) from `articles` where `user`.`id` = `article`.`user_id`) as `article_max_price` from `users` where `articles`.`active` = 1 يجب أن تكون عبارة where في الاستعلام الفرعي ، وليس في الاستعلام الرئيسي. كيف يمكنني تغيير الكود الخاص بي بحيث تكون عبارة where في طلب البحث الفرعي؟
  4. أين يمكن أن نجد قائمة شاملة لخيارات الإعدادات لحزمة Laravel Horizon: يُقدم التوثيق الرسمي (https://laravel.com/docs/8.x/horizon#configuration) مثالاً ولكنها بالتأكيد ليست قائمة شاملة. أعتقد أنه يجب تضمين هذا في التوثيق.
  5. لقد قمت بإنشاء دالة مساعدة في app / Helpers / Dashboard / profCalculation.php في هذا المسار. function quarterCalculation($start_date, $end_date) { return true; } و قمت بتعديل ملف composer.json: "autoload": { "files": [ "app/Helpers/Dashbaord/profitCalculation.php" ] } بعد ذلك قمت بتنفيذ: composer dump-autoload لكنه يُعطي الخطأ التالي: Script Illuminate\Foundation\ComposerScripts::postAutoloadDump handling the post-autoload-dump event terminated with an exception [ErrorException] require(D:\xampp\htdocs\app\vendor\composer/../../app/Helpers/Dashbaord/profitCalculation.php): failed to open stream: No such file or directory لا أعرف ما سبب الخطأ.
  6. لقد كنت أحاول إنشاء وظيفة cron في خادم Ubuntu / Nginx ، في digital Ocean. لقد حاولت ، العديد من الخيارات - * * * * * php /var/www/laravel/artisan schedule:run 1>> /dev/null 2>&1 * * * * * /usr/bin/php /var/www/laravel/artisan schedule:run 1>> /dev/null 2>&1 * * * * * /usr/bin/php /var/www/laravel/artisan schedule:run > /dev/null >> /dev/null 2>&1 لكنني لم أنجح في ذلك ، لا أعرف أين الخطأ في ما أفعله.
  7. لدي جدول المدن في قاعدة البيانات و أحتاج إلى إنشاء مصفوفة من النموذج التالي: [ ['A'] => [ 18 => 'Alexandria', 24 => 'Antioch', 1679 => 'Akron', 1875 => 'Atlanta', 2713 => 'Abilene', ], ['B'] => [ 28 => 'Bakersfield', 154 => 'Billings', 1495 => 'Bridgeport', 2150 => 'Baltimore', 4117 => 'Bend', ] ] حاولت كتابة الكود بنفسي ، لكن اتضح أنه كبير. أنا متأكد من أن هناك حل أكثر إيجازًا. $cities = City::pluck('title', 'id'); $letters = $cities->sort()->map(function($value) { return Str::limit($value, 1, ''); })->unique()->flatten(); $lettersArray = []; foreach ($letters as $letter) { foreach($cities as $key => $city) { if ($letter == Str::limit($city, 1, '')) { $lettersArray[$letter][$key] = $city; } } } كيف يمكنني إعادة بنائه؟ وأحتاج أيضًا إلى فرز المدن حسب الاسم داخل المصفوفة.
  8. كيف يمكنني تحميل ملفات ضخمة باستخدام Livewire لقد قمت بالفعل بترقية خادم / nginx وكل شيء - لكن يبدو أن livewire يرفض الملفات الأكبر حجمًا: { "files.0": [ "The files.0 may not be greater than 12288 kilobytes." ] } لا أعرف أين أصلح ذلك.
  9. أود أن أعرف ما إذا كانت هناك طريقة لعدم إضافة مسار الحذف إلى مورد واستخدام مسار المورد كما هو، في الوقت الحالي ، أفعل ذلك بهذه الطريقة: deleteRequest: function (id, index) { axios.post('/admin/posts/' + id, { _method: 'DELETE' }) .then((response) => { }).catch((error) => { }); لكن لا يمكنني جعله يعمل مع مسار الموارد فقط: Route::resource('/admin/posts', 'Admins\PostController']); يجب أن أضيف هذا دائمًا فوق مسار المورد: Route::post('/admin/posts/{id}', 'Admins\PostController@destroy'); كيف يُمكن حل المشكل
  10. أنا على وشك نشر تطبيق Laravel الخاص بي ، وأتساءل عما يجب أن أستخدمه ، Laravel Forge أو Laravel Envoyer. أريد أن أعرف الاختلافات وأوجه التشابه بينهما
  11. أتلقى الخطأ التالي في مشروعي الذي أستعمل فيه الإصدار الثامن: Attempt to read property "created_by" on null هذا ما يوجد في ملف العرض: <h6><strong>Created By:</strong> {{ $purchase->user->created_by }}</h6> <h6><strong>Updated By:</strong> {{ $purchase->user->updated_by }}</h6> حيث النموذج User: <?php namespace App\Models; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; class User extends Authenticatable { use HasFactory, Notifiable; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'role_id', 'name', 'username', 'email', 'password', ]; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; /** * The attributes that should be cast to native types. * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', ]; public function role(){ return $this->belongsTo('App\Models\Role'); } public function scopeAuthors($query){ return $query->where('role_id',2); } public function products(){ return $this->hasMany('App\Models\Product'); } public function purchases(){ return $this->hasMany('App\Models\Purchase'); } public function invoices(){ return $this->hasMany('App\Models\Invoice'); } } و النموذج Purchase: <?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Purchase extends Model { use HasFactory; public function user(){ return $this->belongsTo('App\Models\User'); } public function supplier(){ return $this->belongsTo('App\Models\Supplier'); } public function category(){ return $this->belongsTo('App\Models\Category'); } public function unit(){ return $this->belongsTo('App\Models\Unit'); } public function product(){ return $this->belongsTo('App\Models\Product'); } } ملف التهجير الخاص بالمستخدمين: public function up() { Schema::create('users', function (Blueprint $table) { $table->id(); $table->integer('role_id')->default(3); $table->string('name'); $table->string('username')->unique(); $table->string('email')->unique(); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); $table->string('image')->default('default.png'); $table->rememberToken(); $table->timestamps(); }); } ملف التهجير الخاص بالمشتريات: public function up() { Schema::create('purchases', function (Blueprint $table) { $table->id(); $table->string('purchase_no'); $table->date('date'); $table->double('buying_qty'); $table->double('unit_price'); $table->double('buying_price'); $table->boolean('status')->default('0'); $table->integer('supplier_id'); $table->integer('category_id'); $table->integer('product_id'); $table->integer('created_by'); $table->integer('updated_by')->nullable(); $table->text('description')->nullable(); $table->timestamps(); }); } ماهو حل المشكلة.
  12. لقد قمت بترقية مشروعي من 6 إلى 7 في البداية ، وكل شيء على ما يرام معه. ولكن عندما يتعلق الأمر بتحديثه من 7 إلى 8 ، فإنني أتلقى بعض الأخطاء والمشكلات التي لا أعرف سبب حدوثها. ملف composer.json: { "name": "laravel/laravel", "type": "project", "description": "The Laravel Framework.", "keywords": [ "framework", "laravel" ], "license": "MIT", "require": { "php": "^7.3", "bugsnag/bugsnag-laravel": "^2.17", "doctrine/dbal": "^2.9", "fideloper/proxy": "^4.0", "laravel/framework": "^8.0", "laravel/passport": "^7.4", "laravel/tinker": "^2.0", "laravel/ui": "^3.0", "laraveldaily/laravel-charts": "^0.1.13", "realrashid/sweet-alert": "^3.2", "symfony/process": "^5.2", "yajra/laravel-datatables-oracle": "^9.7" }, "require-dev": { "facade/ignition": "^2.3.6", "fzaninotto/faker": "^1.4", "mockery/mockery": "^1.0", "nunomaduro/collision": "^5.0", "phpunit/phpunit": "^9.0" }, } وهذه هي الأخطاء التي تظهر عندما انفذ أمر التحديث: Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages. Problem 1 - Conclusion: don't install laravel/framework v8.0.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.0.1 (conflict analysis result) - Conclusion: don't install laravel/framework v8.0.2 (conflict analysis result) - Conclusion: don't install laravel/framework v8.0.3 (conflict analysis result) - Conclusion: don't install laravel/framework v8.0.4 (conflict analysis result) - Conclusion: don't install laravel/framework v8.1.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.2.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.3.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.4.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.5.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.6.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.7.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.7.1 (conflict analysis result) - Conclusion: don't install laravel/framework v8.8.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.9.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.10.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.11.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.11.1 (conflict analysis result) - Conclusion: don't install laravel/framework v8.11.2 (conflict analysis result) - Conclusion: don't install laravel/framework v8.12.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.12.1 (conflict analysis result) - Conclusion: don't install laravel/framework v8.12.2 (conflict analysis result) - Conclusion: don't install laravel/framework v8.12.3 (conflict analysis result) - Conclusion: don't install laravel/framework v8.13.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.14.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.15.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.16.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.16.1 (conflict analysis result) - Conclusion: don't install laravel/framework v8.17.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.17.1 (conflict analysis result) - Conclusion: don't install laravel/framework v8.17.2 (conflict analysis result) - Conclusion: don't install laravel/framework v8.18.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.18.1 (conflict analysis result) - Conclusion: don't install laravel/framework v8.19.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.20.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.20.1 (conflict analysis result) - Conclusion: don't install laravel/framework v8.21.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.22.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.22.1 (conflict analysis result) - Conclusion: don't install laravel/framework v8.23.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.23.1 (conflict analysis result) - Conclusion: don't install laravel/framework v8.24.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.25.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.26.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.26.1 (conflict analysis result) - Conclusion: don't install laravel/framework v8.27.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.28.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.28.1 (conflict analysis result) - Conclusion: don't install laravel/framework v8.29.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.30.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.30.1 (conflict analysis result) - Conclusion: don't install laravel/framework v8.31.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.32.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.32.1 (conflict analysis result) - Conclusion: don't install laravel/framework v8.33.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.33.1 (conflict analysis result) - Conclusion: don't install laravel/framework v8.34.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.35.0 (conflict analysis result) - Conclusion: don't install laravel/framework v8.35.1 (conflict analysis result) - laravel/passport v7.4.0 requires illuminate/auth ~5.6.0|~5.7.0|~5.8.0|^6.0 -> satisfiable by illuminate/auth[v5.6.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev]. - illuminate/auth[v5.6.0, ..., 5.6.x-dev] require illuminate/queue 5.6.* -> satisfiable by illuminate/queue[v5.6.0, ..., 5.6.x-dev]. - illuminate/auth[v5.7.0, ..., 5.7.x-dev] require illuminate/queue 5.7.* -> satisfiable by illuminate/queue[v5.7.0, ..., 5.7.x-dev]. - illuminate/auth[v5.8.0, ..., 5.8.x-dev] require illuminate/queue 5.8.* -> satisfiable by illuminate/queue[v5.8.0, ..., 5.8.x-dev]. - illuminate/auth[v6.0.0, ..., 6.x-dev] require illuminate/queue ^6.0 -> satisfiable by illuminate/queue[v6.0.0, ..., 6.x-dev]. - illuminate/queue[v5.6.0, ..., 5.6.x-dev] require symfony/process ~4.0 -> found symfony/process[v4.0.0-BETA1, ..., 4.4.x-dev] but it conflicts with your root composer.json require (^5.2). - illuminate/queue[v5.7.0, ..., 5.7.x-dev] require symfony/process ^4.1 -> found symfony/process[v4.1.0-BETA1, ..., 4.4.x-dev] but it conflicts with your root composer.json require (^5.2). - illuminate/queue[v5.8.0, ..., 5.8.x-dev] require symfony/process ^4.2 -> found symfony/process[v4.2.0-BETA1, ..., 4.4.x-dev] but it conflicts with your root composer.json require (^5.2). - illuminate/queue[v6.0.0, ..., 6.x-dev] require symfony/process ^4.3.4 -> found symfony/process[v4.3.4, ..., 4.4.x-dev] but it conflicts with your root composer.json require (^5.2). - laravel/passport[v7.4.1, ..., v7.5.1] require illuminate/support ~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0 -> satisfiable by illuminate/support[v5.6.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev]. - Only one of these can be installed: illuminate/support[v5.0.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev], laravel/framework[v8.0.0, ..., 8.x-dev]. laravel/framework replaces illuminate/support and thus cannot coexist with it. - Root composer.json requires laravel/framework ^8.0 -> satisfiable by laravel/framework[v8.0.0, ..., 8.x-dev]. - Root composer.json requires laravel/passport ^7.4 -> satisfiable by laravel/passport[v7.4.0, v7.4.1, v7.5.0, v7.5.1]. Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions. أقوم بترقية الإصدار بإستخدام التوثيق الرسمي.
  13. لا أعرف ما الذي يحدث مع المفتاح الثانوي الخاص بي ، لا يمكنني القيام بعملية التهجير كلما حاولت تنفيذ الأمر، يظهر لي خطأ SQLSTATE[HY000]: General error: 1005 Can't create table abs-b2.articles (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table articles add constraint articles_user_id_foreign foreign key (user_id) references users (id) on delete cascade) هل هناك مُشكلة او خطأ ما أقوم به و كيف أحل المشكلة.
  14. أتلقى هذا الخطأ عندما أنقر على زر إرسال في نموذج الاتصال الخاص بي: Failed to authenticate on SMTP server with username "info@domain.com" using 2 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "535", with message "535 Incorrect authentication data ". Authenticator PLAIN returned Expected response code 235 but got code "535", with message "535 Incorrect authentication data ". لقد قمت بإعداد كل شيء من خلال cPanel و إصدار ال php الخاص بي هو 7.3 لقد استخدمت mailtrap لاختبار نموذج الاتصال الخاص بي وقد نجح ذلك،لا أستطيع أن أفهم لماذا أتلقى هذا الخطأ. الإعدادات الخاصة بالبريد كالتالي: MAIL_DRIVER=smtp MAIL_HOST=mail.domain.com MAIL_PORT=587 MAIL_USERNAME=info@domain.com MAIL_PASSWORD=password MAIL_ENCRYPTION=null
  15. قمت برفع مشروعي على الخادم و قمت بتطبيق cron job التالي: 1 * * * * php /home/webminder/public_html/artisan schedule:run >> /dev/null 2>&1 لا أدري لماذا لا يتنفذ كل دقيقة؟ هل هناك خطأ ما؟ أيضاً هناك مُشكلة أخرى أن السكربت لا يتنفذ من خلال cron job لكن إذا قمت بتنفيذه يدوياً يشتغل بشكل عادي. هذا ملف Kernel.php: <?php namespace App\Console; use DB; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; class Kernel extends ConsoleKernel { /** * The Artisan commands provided by your application. * * @var array */ protected $commands = [ \App\Console\Commands\Reminder::class ]; /** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) { $schedule->command('reminder:renewal')->everyMinute(); } /** * Register the Closure based commands for the application. * * @return void */ protected function commands() { require base_path('routes/console.php'); } } و هذا ملف App\Console\Commands\Reminder.php: <?php namespace App\Console\Commands; use DB; use Illuminate\Console\Command; class Reminder extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'reminder:renewal'; /** * The console command description. * * @var string */ protected $description = 'Renewal Server, Web Hosting and Domain Name'; /** * Create a new command instance. * * @return void */ public function __construct() { parent::__construct(); } /** * Execute the console command. * * @return mixed */ public function handle() { DB::table('test')->insert(['name' => 'Testing']); } } لا أعرف مكان المشكلة.
  16. أقوم بإجراء اختبار ميزة وأحتاج إلى إنشاء بعض النماذج الوهمية في التابع setUp. تكمن المشكلة أنه عند الاستعلام عن قاعدة البيانات ، يبدو أنها لا تزال فارغة كما ترى في الجزء التالي من التعليمات البرمجية: ملف الإختبار: <?php namespace Tests\Feature; use App\Models\Account; use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\TestCase; class ProcessOutreachTest extends TestCase { use RefreshDatabase; protected function setUp(): void { parent::setUp(); Account::factory()->count(50)->create(); dd(Account::all()); // returns empty array } } ملف الإعدادات phpunit.xml: <php> <server name="APP_ENV" value="testing"/> <server name="BCRYPT_ROUNDS" value="4"/> <server name="CACHE_DRIVER" value="array"/> <server name="DB_CONNECTION" value="sqlite"/> <server name="DB_DATABASE" value=":memory:"/> <server name="MAIL_DRIVER" value="array"/> <server name="QUEUE_CONNECTION" value="sync"/> <server name="SESSION_DRIVER" value="array"/> </php> ملف التهجير: <?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateAccounts extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('accounts', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('email'); $table->text('access_token'); $table->timestamp('deleted_at'); $table->timestamps(); }); } } ملف ال Factory: <?php namespace Database\Factories; use App\Models\Account; use Illuminate\Database\Eloquent\Factories\Factory; class AccountFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ protected $model = Account::class; /** * Define the model's default state. * * @return array */ public function definition() { return [ 'access_token' => null, 'email' => $this->faker->unique()->email, 'deleted_at' => null, ]; } }
  17. كيف يمكنني إعادة التوجيه إلى مسار معين إذا أدخل المستخدم أي شيء في عنوان، أي مسار غير موجود، مثلاً: المسار الصحيح هو: http://localhost/admin/approve و أدخل المستخدم العنوان التالي: http://localhost/admin/approvedfdgghk يأتيني الخطأ التالي: NotFoundHttpException in RouteCollection.php line 119: أريد في هذه الحالة إعادة توجيه المُستخدم للصفحة الرئيسية. كيف يمكن ذلك.
  18. لقد تمكنت حتى الآن من استخدام Socialite وجعل المستخدمين يسجلون الدخول ، لكنني الآن أود البدء في حفظ العديد من رموز OAuth المميزة. أين يتم تخزين هذه المفاتيح؟ أيضًا ، هل من الممكن تغيير مكان حفظ هذه المفاتيح وتعديلها عندما يحتاج المستخدم إليها؟
  19. أستخدم Laravel Jetstream و أريد أن اتيح للمُستخدم إضافة صورته الشخصية أثناء التسجيل و هذا ما وجدته في الملف CreateNewUser.php: <?php public function create(array $input) { Validator::make($input, [ 'name' => ['required', 'string', 'max:255'], 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 'password' => $this->passwordRules(), 'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['required', 'accepted'] : '', ])->validate(); return DB::transaction(function () use ($input) { return tap(User::create([ 'name' => $input['name'], 'email' => $input['email'], 'password' => Hash::make($input['password']), ]), function (User $user) { $this->createTeam($user); }); }); } كيف يُمكنني إتاحة الأمر و أين أضيف الشيفرة التي تسمح برفع الصورة الشخصية ؟
  20. أحاول القيام بالتالي في مكون Livewire: $alertes = Alerte::with(['salarie', 'formation']) ->join('formations', 'formations.id', '=', 'alertes.formation_id') ->addSelect(DB::raw('date_add(formations.date_fin, interval formations.duree_validite month) as date_recyclage')) ->where('formations.entreprise_id', $this->entreprise_id) ->when($this->traitee, function ($query) { $query->where('traitee', $this->traitee); }) ->orderByRaw($this->critere_tri, $this->asc ? 'asc' : 'desc') ->paginate($this->nombre_par_page); ولكن عندما أحاول عرض : $alerte->formation->intitule فإنها لا تعمل: intitule not found لقد ألقيت نظرة على نتيجة الاستعلام مع dd. لدي حقل واحد فقط: date_recyclage. لماذا لدي حقل واحد فقط في حين أن بداية الاستعلام الخاص بي يجب أن يعيد السجلات مع salarie و formation . ما الخطأ في الكود الخاص بي؟
  21. عندما أستخدم eloquent ، يمكنني استخدام طريقة "where" ثم طريقة "get" لملء كائن يحتوي على ما حددته في قاعدة البيانات الخاصة بي. يعني: $users = User::where('gender', 'M')->where('is_active', 1)->get(['pseudo', 'email', 'age', 'created_at'])->toArray(); هنا يمكنني اختيار الأعمدة التي أريد الحصول عليها مثل "pseudo" ، "email" ، إلخ. ولكن ما أريده هو طريقة القيام بالعكس. يمكن أن يكون شيئًا من هذا القبيل: $users = User::where('gender', 'M')->where('is_active', 1)->notGet(['pseudo', 'email', 'age', 'created_at'])->toArray(); هل هناك طريقة معينة لعمل ذلك؟
  22. في إطار Laravel ، يمكننا استخدام الشفرة لإضافة كود PHP في ملف html. نحن نستخدم كلاً من {{}} و {!! !!} في ملفات الشفرات في Laravel. ما الفرق بينهم؟
  23. لا أعرف ما هو الخطأ ، حتى الآن أقوم باختبار من خلال console log :عندما أقوم بتشغيل npm run watch ، أتلقى الخطأ التالي: "Webpack is watching the files… 95% emitting ERROR Failed to compile with 1 errors 19:42:29 error in ./resources/assets/js/components/File.vue (Emitted value instead of an instance of Error) Vue template syntax error: Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead. @ ./resources/assets/js/components/AvatarUpload.vue 5:2-181 @ ./resources/assets/js/app.js @ multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss" ملف vue الخاص بي: <template> <div class="form-group"> <label for="avatar" class="control-label">Avatar</label> <input type="file" v-on:change="fileChange" id="avatar"> <div class="help-block"> Help block here updated 4 🍸 ... </div> </div> <div class="col-md-6"> <input type="hidden" name="avatar_id"> <img class="avatar" title="Current avatar"> </div> </template> <script> export default{ methods: { fileChange(){ console.log('Test of file input change') } } } </script> كيف يُمكنني حل هذه المُشكلة؟
  24. أحاول التحقق مما إذا كان المستخدم لديه الصلاحية لنموذج معين في لارافيل، أضفت هذا الكود إلى الباني: public function __construct() { if (!Auth::user()->hasPermission('usergroups')) { abort(404); } } ترجع Auth :: user القيمة null عند استدعائها من الباني.لكن إن استخدمتها في أي تابع آخر ، فإنه يعيد المستخدم الذي قام بتسجيل الدخول حاليًا، لماذا لا تعمل في الباني.
  25. أريد إنشاء تطبيق ويب Laravel يسمح لمستخدم إداري او مشرف على النظام بتغيير بعض المتغيرات (مثل بيانات اعتماد قاعدة البيانات) في ملف .env باستخدام نظام الواجهة الخلفية للويب. لكن كيف أحفظ التغييرات؟
×
×
  • أضف...