رفتن به مطلب
انجمن پشتیبانی لاراول ایران

هاست لاراول با پشتیبانی 24 ساعته و امکانات کامل از مدیرهاست

Recommended Posts

سلام دوستان
من یه فروشگاه دارم که دارم از یه پکیج پرداخت استفاده میکنم
حالا میخوام مواردی که خریداری شده رو نمایش بدم اما به این مشکل بر میخورم1Q8jgssAQ8IAE1r7U7B7UOpuTizQZCNcNZV5kcZf

 

class PurchasedCourse extends Model
{
    use HasFactory;
 
    protected $fillable = [
        'user_id',
        'course_id',
    ];
 
    public function course()
    {
 
        return $this->belongsTo(Course::class,'course_id');
    }
}

 

 public function up()
    {
        Schema::create('courses', function (Blueprint $table) {
            $table->id('id');
            $table->string('name')->unique();
            $table->string('start');
            $table->string('end');
            $table->integer('price');
            $table->string('jalasat');
            $table->string('zarfiat');
            $table->text('tozih');
            $table->integer('hit');
            $table->string('departmant');
            $table->string('thumbnail');
            $table->tinyInteger('status')->default(0);
            $table->string('slug')->unique();
            $table->timestamps();
        });
 
    }

 

 

public function mycourse(){
 
        $courses= PurchasedCourse::where('user_id',Auth::id())
        ->with('course')
        ->get();
 
      dd($courses);
            return view('student.courses.mycourse',[
                'courses'=>$courses
            ]);
 
    }

 

 

course رو نال برمیگردونه و فقط تعداد دوره های خریداری شد رو برمیگردونه!
ممنون میشم راهنماییم کنید

Share this post


Link to post
Share on other sites

هاست لاراول با پشتیبانی 24 ساعته و امکانات کامل از مدیرهاست

وارد این گفتگو شوید

میتوانید پیام خود را ارسال کنید و بعد ثبت نام نمایید. در صورتی که حساب کاربری دارید, هم اکنون وارد شوید و در این گفتگو شرکت کنید.

مهمان
پاسخ به این موضوع ...

×   شما در حال چسباندن محتوایی با قالب بندی هستید.   حذف قالب بندی

  Only 75 emoji are allowed.

×   لینک شما به صورت اتوماتیک جایگذاری شد.   نمایش به عنوان یک لینک به جای

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • جدید...