MarkTierney

MarkTierney

Member Since 3 Years Ago

Blackpool

Web Developer at Interactive Dimension

Experience Points 16,980
Experience Level 4

3,020 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 164
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.

02 Jul
2 weeks ago

MarkTierney left a reply on Invalid Numeric Literal

My mistake, I had a global scope on the Model, doh!

Casting the number as a string solves this problem.

MarkTierney left a reply on Invalid Numeric Literal

I have also tried treating the id as a string with the same results. It seems as though the record is invisible to Eloquent because of the '08'.

App\RealNotification::withTrashed()->where('id', '000350089390')->get();
App\RealNotification::withTrashed()->where('id', (string) '000350089390')->get();
App\RealNotification::withTrashed()->where('id', 'LIKE',  '%89390%')->get();

All return zero results.

MarkTierney started a new conversation Invalid Numeric Literal

DB::select(DB::raw("select * from notifications where id = 000350089390")) // Yields one result from database.

But:

App\RealNotification::withTrashed()->where('id', 000350089390)->get();

Produces:

Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_PARSE)
Parse error: Invalid numeric literal

Is there a workaround for this, it seems to be something that changed in php7.

26 Jun
3 weeks ago

MarkTierney left a reply on Is REPLACE INTO Possible In The Query Builder Or Eloquent?

Thanks, yes raw is always an option. I'm not sure how much benefit there will be refactoring from my current scenario (find matches, delete, then insert new) to using replace into. Only one way to find out :-)

25 Jun
3 weeks ago

MarkTierney started a new conversation Is REPLACE INTO Possible In The Query Builder Or Eloquent?

Currently I have a table with thousands of entries and only a primary key (no indexes) so mass updates take forever.

I'm currently finding all relevant entries, deleting them and then doing a mass insert of the updated records as the id isn't really important.

I know this is normally something I could do with REPLACE INTO in MySQL, I just wondered if there's a way of doing using built in functions, I can't seem to find anything.

14 May
2 months ago

MarkTierney started a new conversation Automatically Restart Mysql After Valet Restart?

I'm finding that every time I change php version in valet I need to restart mysql otherwise it doesn't work properly.

Is there a native way to achieve this? Or do I need to write my own script?

Thanks!

15 May
1 year ago

MarkTierney left a reply on Advice Needed: Save And Continue On A Form.

Thanks, yes this makes sense.

The thing I'm worried about is I'm essentially saving invalid data, which could potentially be a security risk.

MarkTierney started a new conversation Advice Needed: Save And Continue On A Form.

I have a multi-page form with hundreds of inputs. The validation of the data is crucial once the form is complete, but I also need a 'Save and continue' feature if the user doesn't have all the information to hand.

Obviously I can't save invalid data (missing fields etc), so what would be the best approach to take?

I suppose I could dump all the form values into a json object and save it in a different table maybe? And only validate the data on 'save' (not 'save and continue').

Thanks in advance :)

05 Mar
1 year ago

MarkTierney left a reply on Using A Trait In All Controllers

This works using self::success() instead of Alert::success() -

return redirect(route('customer.index'))->with(self::success('Success message here!'));

Must be bad practice to use static methods on a trait from a parent class maybe?

MarkTierney left a reply on Using A Trait In All Controllers

This is what my base Controller class looks like.

MarkTierney left a reply on Using A Trait In All Controllers

Inside say the update method:

return view('customer.index')->with(Alert::success('Success message here!'));

Is it because I'm calling static methods on the trait?

MarkTierney started a new conversation Using A Trait In All Controllers

Hi

I wanted to use an Alert trait on all my controllers so I imported it to the main Controller class (app/Http/Controllers/Controller.php). However none of my controllers could find the trait.

Any idea why?

01 Dec
1 year ago

MarkTierney left a reply on Multi PHP Versions On Server. Possible To Make Artisan Run From Public Directory?

Awesome, thank you! Seems obvious now you say it, doh!

MarkTierney started a new conversation Multi PHP Versions On Server. Possible To Make Artisan Run From Public Directory?

Hi

I've got multiple Laravel sites on a VPS (Centos 6). I have some running Laravel 4.2, some on 5.2 and some on 5.5.

I'm running EasyApache 4 on the server which allows me to have different versions of php for each domain which is great, the laravel sites all run fine but artisan commands have stopped working on the older versions of Laravel.

Any artisan commands give me the following:

[Symfony\Component\Debug\Exception\FatalThrowableError] Call to undefined function mysql_connect()

If I do 'php -v' in the Laravel directory it always say php7.1 is running but if I go into the public directory it will give me the correct version for each domain.

So I'm wondering if there's a way I can make artisan run from the public directory so it sees the correct php version for the application.

21 Jan
3 years ago

MarkTierney left a reply on Can't Echo Php String Because It's Too Long?

It turns out to be some kind of buffering issue. The php page is filling up the buffer and never getting a response.

I found a workaround, calculating the header content size and adding it to the headers allows the page to load.

Here is the middleware I found that could do this for anyone else encountering this weird issue: https://laracasts.com/discuss/channels/general-discussion/add-content-length-header-on-views?page=1

MarkTierney left a reply on Add Content-Length Header On Views

This just helped me out loads, thanks!

20 Jan
3 years ago

MarkTierney left a reply on Can't Echo Php String Because It's Too Long?

Yeah but it loads fine in the same browsers on my local machine. Oddness indeed!

MarkTierney left a reply on Can't Echo Php String Because It's Too Long?

What is bizarre is that the script loads fine if I view it on the same network on an iphone!

MarkTierney left a reply on Can't Echo Php String Because It's Too Long?

Haha, i'm outputting a virtual file tree with lots of files with long names!

The problem boils down to the length of the string (lots of nested unordered lists) I'm trying to output.

I've checked my error_logs and there's nothing there. I've gone through all my php ini settings and set them to at least what my local machine is set to. Plus if the string is 2 million characters long it executes in under a second so I'm sure it's not a time thing.

Thanks for your answer though!

MarkTierney started a new conversation Can't Echo Php String Because It's Too Long?

Hi I've tried asking this on stackoverflow to no avail so I thought I'd try here.

I have a problem on my live server where the script below won't run and just causes the page to hang. If I reduce the number of loops to 2,000,000 it works. So i'm guessing there's some config I need to change. However I've upped everything I can think of to accommodate long running scripts, file uploads, max request size etc and nothing is working.

Any help or suggestions would be greatly appreciated!

$data = '';

for($i = 0; $i < 3000000; $i++) { $data .= 1; }

echo $data;