elargento23

elargento23

Member Since 8 Months Ago

Experience Points
1,360
Total
Experience

3,640 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
9
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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
1,360 XP
Dec
14
21 hours ago
Activity icon

Replied to How To Upload Images With Froala Editor?

Did you make this work? I just resolved this yesterday and upload image is working fine on Froala

Nov
28
2 weeks ago
Activity icon

Awarded Best Reply on Array_merge(): Expected Parameter 1 To Be An Array, String Given

Solved. The return view was missing compact(): return view ('2ndscreen', compact('question');

Activity icon

Replied to Array_merge(): Expected Parameter 1 To Be An Array, String Given

Solved. The return view was missing compact(): return view ('2ndscreen', compact('question');

Activity icon

Started a new Conversation Array_merge(): Expected Parameter 1 To Be An Array, String Given

I have the following code:

public function selected_degree ($degree_id) {
    session(['degree_id' => $degree_id]);

    $question = DB::table('questions')
        ->select('questions.question_text','questions.answer_time_minutes','questions.answer_time_seconds', 'question_id')
        ->where('degree_id', session('degree_id'))
        ->orderByRaw('RAND()')
        ->take(1)->first();

    // save the question id returned in an array in session
    Session::push('questions', $question->question_id);
    // save the position as 0 because is the first time the query is run
    Session::put('array_position', 0);

    return view('2ndscreen', 'question');
}

I don't understand why I am getting this error: array_merge(): Expected parameter 1 to be an array, string given.

There are no more details about this error.

Nov
26
2 weeks ago
Activity icon

Started a new Conversation Array Player

I was wondering to know which ways I have to go through an array through previos/next buttons, starting from the latest position of an array.

Activity icon

Replied to Passing A Parameter Through URL

Finally I was able to resolve this. Laravel was showing $degree_id value as '?' when I was using dd(DB::getQueryLog());

However, this value was passed but not displayed using this function. I thought the query was wrong (displaying ? instead of a number) but it worked anyway.

Activity icon

Replied to Passing A Parameter Through URL

I'm passing the degree_id through the URL but the query doesn't insert the value. Instead, it returns ?

dd($degree_id') returns 1 The query should return where questions.degree_id = 1 ->where('questions.degree_id', $degree_id)

However, the complete query using dd(DB::getQueryLog()); returns: select questions.question_text, questions.answer_time_minutes, questions.answer_time_seconds from questions inner join universities on universities.university_id = questions.university_id where questions.degree_id = ? order by RAND() limit 1

As you can see, the query returns = ? but it should return = 1

Activity icon

Replied to Passing A Parameter Through URL

Good suggestion. It has value 1 so it's working but

->where('questions.degree_id', $degree_id)

is returning where questions.degree_id = ?

I'm not sure why

Activity icon

Started a new Conversation Passing A Parameter Through URL

Route::get('/questions/{category}', '[email protected]')->name('welcomesecond');

executes the following:

public function second($degree_id) {
    $question = DB::table('questions')
        ->select('questions.question_text','questions.answer_time_minutes','questions.answer_time_seconds')
        ->join('universities', 'universities.university_id', 'questions.university_id')
        ->orderByRaw('RAND()')
        ->where('questions.degree_id', $degree_id)
        ->take(1)->first();

    return view('2ndscreen', compact('question'));
}

However, even when I pass the value through the URL, $degree_id has no value assigned: URL: questions/1

Any ideas what I am doing wrong?

Activity icon

Replied to Can't See The Complete Query So I Don't Know What's Wrong

The 2nd returns Trying to get property 'question_text' of non-object

The 1st one returns the query :)

Activity icon

Replied to Can't See The Complete Query So I Don't Know What's Wrong

the query logs returns an empty array:

[]

    $question = DB::table('questions')
        ->select('questions.question_text','questions.answer_time_minutes','questions.answer_time_seconds')
        ->join('universities', 'universities.university_id', 'questions.university_id')
        ->orderByRaw('RAND()')
        ->where('questions.degree_id', $degree_id)
        ->take(1)->first();

    DB::enableQueryLog();
    dd(DB::getQueryLog());
Activity icon

Replied to Can't See The Complete Query So I Don't Know What's Wrong

I just inserted it at the end:

    $question = DB::table('questions')
        ->select('questions.question_text','questions.answer_time_minutes','questions.answer_time_seconds')
        ->join('universities', 'universities.university_id', 'questions.university_id')
        ->orderByRaw('RAND()')
        ->where('questions.degree_id', $degree_id)
        ->take(1)->first()
        ->toSql ();
Activity icon

Replied to Can't See The Complete Query So I Don't Know What's Wrong

->toSql (); returns Call to a member function toSql() on null

Activity icon

Started a new Conversation Can't See The Complete Query So I Don't Know What's Wrong

I have the following function: public function second($degree_id) {

    $question = DB::table('questions')
        ->select('questions.question_text','questions.answer_time_minutes','questions.answer_time_seconds')
        ->join('universities', 'universities.university_id', 'questions.university_id')
        ->orderByRaw('RAND()')
        ->where('questions.degree_id', $degree_id)
        ->take(1)->first();

    return view('2ndscreen', compact('question'));
}

This query it is supposed to:

  • Get some columns from question table (question_text, questions.answer_time_minutes and questions.answer_time_seconds)
  • Match university_id columns from questions and universities tables
  • Random order
  • Show the questions whose questions.degree_id is equal to the value passed through the function.

Is there any way to see this query in raw format so I can find out what's wrong?

Thank you

Sep
16
2 months ago
Activity icon

Replied to How To Reload A Foreach Or View?

but a new random question must be loaded from the database so I must load the index function again. Javascript and AJAX won't be able to send and receive data from the controller

Activity icon

Started a new Conversation How To Reload A Foreach Or View?

I have a controller which loads a random question:

public function index () {
    $question = Question::orderByRaw('RAND()')->take(1)->get();

    return view('welcome', compact('question'));
}

Inside the view, there is a foreach which displays the random question:

                                    <div class="block-content">
                                        @foreach($question as $q)
                                        <h2 class="font-w400">{{$q->question_text}}</h2>@endforeach</div>

So, I want to insert a button on the view to get a new random question without having to reload the page (because in the future I want to add some filters through Radiobuttons and such so send certain parameters to the controller and get random questions based on certain criteria).

Now you know the situation, which is the best approach? Should I create a secondary view to load the foreach as a section and then reload the section only?

Aug
31
3 months ago
Activity icon

Commented on Databases And Migrations

Where do you change varchar to 150? I can't find the type of column on migrations folder