filipc

filipc

Member Since 3 Years Ago

Experience Points
35,990
Total
Experience

4,010 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
327
Lessons
Completed
Best Reply Awards
5
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 8
35,990 XP
Jul
09
1 day ago
Activity icon

Replied to Laravel Auth Middleware On Routes Testing With PHPunit

You can use dump to see what you're getting, and go from there.

/** @test */
public function guests_cannot_visit_the_admin_pages()
{
    $this->withoutExceptionHandling();
    
    $this->get('/admin')->dump()
}

Activity icon

Replied to Anyway To Fix Request()->validate Error: Array_map():Expected Parameter 2 To Be An Array, Int Given

What is your goal with this line? 'role_id' => Roles::customer()->firstOrFail()->id,

Are you trying to set the value or check that it equals that id?

Activity icon

Replied to How To Enforce Dd/mm/yyyy On Datepicker

OK, I remembered that jquery doesn't use the same syntax as carbon. I think you should set it to 'yy-mm-dd'.

Jul
08
2 days ago
Activity icon

Replied to Where Query - Using Calculated Date Value From Record In The DB

yes, tests are usually run through sqlite

You could extract this logic into its own class, make an interface and then have different implementations for MySQL and SQLite, but this is more advanced.

Else if you don't expect many records for this table, you could try filtering them through PHP

Jul
07
3 days ago
Activity icon

Replied to Where Query - Using Calculated Date Value From Record In The DB

https://www.google.com/search?client=ubuntu&channel=fs&q=%22General+error%3A+1+no+such+function%3A+NOW%22&ie=utf-8&oe=utf-8

Never seen this kind of error, but it seems to be connected to sqlite, but I may be wrong. Good luck figuring it out

Activity icon

Replied to Where Query - Using Calculated Date Value From Record In The DB

also try this:

$tests = Test::active()->whereRaw("start_date = DATE(NOW())")->get();

if that passes, try this $tests = Test::active()->whereRaw("start_date = DATE(SUBDATE(NOW(), INTERVAL 1 DAY))")->get();

Activity icon

Replied to Where Query - Using Calculated Date Value From Record In The DB

hold on I meant trying SELECT on its own so we can figure out what would happen

Do you have mysql workbench or phpmyadmin?

If not then try this

dd(DB::statement("SELECT SUBDATE(NOW(), INTERVAL 1 DAY)"));

Activity icon

Replied to Accessing Form Values Posted As Objects In Controller

is the address empty like in the example

Activity icon

Replied to Where Query - Using Calculated Date Value From Record In The DB

try subdate instead of datesub

SELECT SUBDATE(NOW(), INTERVAL 1 DAY)

Activity icon

Replied to Where Query - Using Calculated Date Value From Record In The DB

can you try datesub on its own? SELECT DATE_SUB(NOW(), INTERVAL 1 DAY)

Activity icon

Replied to Where Query - Using Calculated Date Value From Record In The DB

Either you have a different type of database or you may have one brace too many in the raw part, can you check that? Because i tried it myself and it should work.

$tests = Test::active()->->whereRaw("start_date = DATE(DATE_SUB(NOW(), INTERVAL {{column_name}} DAYS))")
Activity icon

Replied to Accessing Form Values Posted As Objects In Controller

For validation you can use dot notation. For example, if you wanted to check adr_line_1 then

$rules = [
	"address.adr_line_1" => "required"
]

To access them first access the root then the child

$addressLine1 = request()->address['adr_line_1']
Activity icon

Replied to Where Query - Using Calculated Date Value From Record In The DB

also DATE(DATE_SUB(NOW(), INTERVAL variation_length DAY)))

to remove the hour minute second

Activity icon

Replied to Where Query - Using Calculated Date Value From Record In The DB

INTERVAL variation_length DAY

try that

Activity icon

Replied to Where Query - Using Calculated Date Value From Record In The DB

I think this will have to be done through SQL with raw. Not sure if this will work but worth a try:

$tests = Test::active()->whereRaw("start_date = DATE_SUB(NOW(), INTERVAL {{column_name}} DAYS)")

make sure to replace {{column_name}} with the column where you store the days

Activity icon

Replied to How To Enforce Dd/mm/yyyy On Datepicker

try dateFormat instead of format

Activity icon

Replied to Two Checkboxes On The Same Form Don't Work.

I think your problem is here:

value="{{ $user->active }}"
...
 value="{{ $user->salary }}"

The value of the checkboxes should be fixed, the users input is in whether or not the checkbox is checked

 {{ $user->salary ? 'checked' : '' }}

and not the value

Jun
30
1 week ago
Activity icon

Replied to How To Query Though A Pivot Table?

The line

ContactRole::where('id', 5)->get();

returns a collection of eloquent models that match the condition. In this case it would return a collection containing one record.

When you try access $project_managers->contacts you're trying to get the contacts property of the collection and since the collection doesn't have this property, it fails.

Property [contacts] does not exist on this collection instance. (View: /root/resources/views/project/create.blade.php)

Find is a helper method that returns the eloquent object where the primary key (id) matches the given value. In this case it's shorthand for

ContactRole::where('id', 5)->first();

Because this doesn't return a collection, but a single eloquent object, the property contacts exists.

Mar
04
4 months ago
Activity icon

Replied to Validation Passed On Required_if

I think there's no support for range of values in 'required if'.

https://laravel.com/docs/5.8/validation#rule-required-if

I suggest you replace it with a closure

'time_frame_type'  => Rule::requiredIf(function() use ($request) {
	return $request->type > 0 && $request->type < 6;
})