vector_rashed

vector_rashed

Member Since 3 Weeks Ago

Rangpur

Experience Points
210
Total
Experience

4,790 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 1
210 XP
Oct
25
3 days ago
Activity icon

Started a new Conversation Laravel Yajra Box, I Am Trying To Set Up Yajra Box With Relationship Table But It's Now Working.

Help me with laravel Yajra, I am trying to set up yajra box with relationship table but it's now working.

My Payment Table

$table->bigIncrements('id');
$table->unsignedBigInteger('patients_id');
$table->string('description')->nullable();
$table->foreign('patients_id')->references('id')->on('patients')->onDelete('cascade');
$table->unsignedBigInteger('test_id');
$table->foreign('test_id')->references('id')->on('tests');
$table->timestamps();

Route:

Route::get('payments', [ 'uses' => '[email protected]','as' => 'payment'])->middleware('auth');

Payment model:

    public function patient() {
        return $this->belongsTo('App\Patients', "patients_id");
    }

    public function tests() {
        return $this->belongsTo('App\Test', "test_id");
    }

Payment Controller

    public function getPaymentData(Request $request){

        if ($request->ajax()) {
            $model = payment::with('tests');
                return DataTables::eloquent($model)
                ->addColumn('tests.name', function (payment $payment) {
                    return $payment->tests->name;
                })
                ->toJson();
        }

        return view('payment.create_payment');
    }

View:

$(function () {
    
        var table = $('.yajra-datatable').DataTable({
            processing: true,
            serverSide: true,
            ajax: "{{ route('payment') }}",
            columns: [
                {data: 'id', name: 'id'},
                {data: 'name', name: 'tests.name'},
                {data: 'description', name: 'description'},
                {data: 'created_at', name: 'created_at'},
                {
                    data: 'action', 
                    name: 'action', 
                    orderable: true, 
                    searchable: true
                },
            ]
        });
        
    });

Error from console

jquery-3.4.1.js:3850 Uncaught TypeError: Cannot read property 'style' of undefined
    at Fa (jquery.dataTables.min.js:62)
    at ha (jquery.dataTables.min.js:48)
    at e (jquery.dataTables.min.js:93)
    at HTMLTableElement.<anonymous> (jquery.dataTables.min.js:93)
    at Function.each (jquery-3.4.1.js:367)
    at jQuery.fn.init.each (jquery-3.4.1.js:202)
    at jQuery.fn.init.n [as dataTable] (jquery.dataTables.min.js:83)
    at jQuery.fn.init.h.fn.DataTable (jquery.dataTables.min.js:165)
    at HTMLDocument.<anonymous> (2010101:791)
    at mightThrow (jquery-3.4.1.js:3557)
Oct
18
1 week ago
Activity icon

Replied to Jsquarehospital.com Is Currently Unable To Handle This Request. HTTP ERROR 500

Many many thanks to give me your valuable time. It is my first deploy that's why I am facing a lot's of problem. I even didn't know that project env is local. Thanks again.

Activity icon

Replied to Jsquarehospital.com Is Currently Unable To Handle This Request. HTTP ERROR 500

Thanks for your suggestions. I have changed the users for my phpmyadmin and remove the .env.

But on server how to generate encryption key and set .env to private? I am using shared hosting and there is no ssh.

Activity icon

Started a new Conversation Jsquarehospital.com Is Currently Unable To Handle This Request. HTTP ERROR 500

I am first time deploying my laravel project in a shared hosting.

I got error:

This page isn’t workingjsquarehospital.com is currently unable to handle this request.
HTTP ERROR 500

I deployed following this tutorial https://www.youtube.com/watch?v=6g8G3YQtQt4

Method: uploaded zip in root directory, then uploaded the public folder in public_html and changes index.php

Please help me. My error log

[Sun Oct 18 14:00:33.054366 2020] [php7:warn] [pid 24621] [client 103.25.250.225:28241] PHP Warning:  require(/home/projectname/domains/domain.com/public_html/../projectname/vendor/autoload.php): failed to open stream: No such file or directory in /home/projectname/domains/domain.com/public_html/index.php on line 24
[Sun Oct 18 14:00:33.054390 2020] [php7:error] [pid 24621] [client 103.25.250.225:28241] PHP Fatal error:  require(): Failed opening required '/home/jsquare/domains/domain.com/public_html/../projectname/vendor/autoload.php' (include_path='.:/usr/local/php73/lib/php') in /home/projectname/domains/domain.com/public_html/index.php on line 24
Oct
13
2 weeks ago
Activity icon

Replied to SQLSTATE[23000]: Integrity Constraint Violation: 1452 Cannot Add Or Update A Child Row: A Foreign Key Constraint Fails (`bd_name`.`inpatients`, CONSTRAINT `inpatients_ward_id_foreign` FOREIGN KEY (`ward_id`) REFERENCES `wards` (`id`)) (SQL: Insert Into `i

That's happens because of ward no. The foreign key is word_id and the data I passed from the view is the ward_no.

Now it's fixed. Thanks for you valuable time. :)

Activity icon

Replied to SQLSTATE[23000]: Integrity Constraint Violation: 1452 Cannot Add Or Update A Child Row: A Foreign Key Constraint Fails (`bd_name`.`inpatients`, CONSTRAINT `inpatients_ward_id_foreign` FOREIGN KEY (`ward_id`) REFERENCES `wards` (`id`)) (SQL: Insert Into `i

Ward Model here

    protected $fillable = [
    'ward_id','patient_id',
    ];

    public function ward() {
        return $this->belongsTo('App\Ward');
    }
    
    public function patient() {
        return $this->belongsTo('App\Patients');
    }

And the patient model here

    public function inpatient() {
        return $this->hasOne('App\inpatient');
    }

This only have issues, other wise all application running without any error.

Activity icon

Replied to How To Store BelongsToMany?

Many-to-many relationships are defined by writing a method that returns the result of the belongsToMany method. For example, let's define the roles method on our User model:

public function roles()
    {
        return $this->belongsToMany('App\Models\Role');
    }

Once the relationship is defined, you may access the user's roles using the roles dynamic property:

$user = App\Models\User::find(1);

foreach ($user->roles as $role) {
    //
}

Like all other relationship types, you may call the roles method to continue chaining query constraints onto the relationship:

$roles = App\Models\User::find(1)->roles()->orderBy('name')->get();

For more visit https://laravel.com/docs/8.x/eloquent-relationships#many-to-many

Activity icon

Started a new Conversation SQLSTATE[23000]: Integrity Constraint Violation: 1452 Cannot Add Or Update A Child Row: A Foreign Key Constraint Fails (`bd_name`.`inpatients`, CONSTRAINT `inpatients_ward_id_foreign` FOREIGN KEY (`ward_id`) REFERENCES `wards` (`id`)) (SQL: Insert Into `i

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`bd_name`.`inpatients`, CONSTRAINT `inpatients_ward_id_foreign` FOREIGN KEY (`ward_id`) REFERENCES `wards` (`id`)) (SQL: insert into `inpatients` (`patient_id`, `ward_id`, `updated_at`, `created_at`) values (2010101, 06, 2020-10-14 06:44:12, 2020-10-14 06:44:12))

My inpatient table is here:

$table->bigIncrements('id');
$table->timestamps();
$table->unsignedBigInteger('patient_id');
$table->foreign('patient_id')->references('id')->on('patients');
$table->char('discharged',4)->default('NO'); // YES | NO
$table->unsignedBigInteger('ward_id');
$table->foreign('ward_id')->references('id')->on('wards');

My inpatientController

$INPtable = new inpatient;
$INPtable->patient_id = $request->reg_pid;
$INPtable->ward_id = $request->reg_ipwardno;

Inpatient Model

    protected $fillable = [
    'ward_id','patient_id',
    ];

    public function ward() {
        return $this->belongsTo('App\Ward');
    }
    
    public function patient() {
        return $this->belongsTo('App\Patients');
    }

Please Help me