SCC

SCC

Member Since 6 Years Ago

Glasgow

Experience Points
28,385
Total
Experience

1,615 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
207
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 6
28,385 XP
Jul
04
1 week ago
Activity icon

Awarded Best Reply on Can You Set Migrations To Have Already Been Run?

So really then the issue as I suspected is that when I deployed for the 1st time through Forge then imported a database backup, the issue was that some updates I had done meant that the migration names had changed slightly so a mismatch.

The solution was to change the migration names locally to match what was in the remote database then push to GitHub, once that happened Forge ran the automatic deploy, the migrations matched, all show as having been run and errors all gone!

Activity icon

Replied to Can You Set Migrations To Have Already Been Run?

So really then the issue as I suspected is that when I deployed for the 1st time through Forge then imported a database backup, the issue was that some updates I had done meant that the migration names had changed slightly so a mismatch.

The solution was to change the migration names locally to match what was in the remote database then push to GitHub, once that happened Forge ran the automatic deploy, the migrations matched, all show as having been run and errors all gone!

Activity icon

Started a new Conversation Can You Set Migrations To Have Already Been Run?

So, I moved servers from one provider to another, set it all up through Forge and somewhere along the way it went somewhat wrong. The site is running fine but when 'Quick Deploy' is running on Forge I keep getting errors but the changes I make still update.

I figured out that it's the migrations when I did the move deployed everything through GitHub and then imported the database from a backup, that appears to be the issue.

I see this when I run php artisan migrate:status

+------+------------------------------------------------+-------+
| Ran? | Migration                                      | Batch |
+------+------------------------------------------------+-------+
| Yes  | 2014_10_12_000000_create_users_table           | 1     |
| Yes  | 2014_10_12_100000_create_password_resets_table | 1     |
| Yes  | 2019_08_19_000000_create_failed_jobs_table     | 1     |
| No   | 2020_07_03_101319_create_blog_tables           |       |
| No   | 2020_07_03_104318_create_comments_table        |       |
| No   | 2020_07_03_151418_create_user_roles_tables     |       |
| No   | 2020_07_03_160844_create_images_table          |       |
| No   | 2020_07_03_221736_create_support_tables        |       |
| No   | 2020_07_03_221819_create_guides_tables         |       |
+------+------------------------------------------------+-------+

So each time I do an update I keep getting a deploy failed message in forge as some of the migrations have not run but as I mentioned all is fine on the site.

Is there any way to force all of these migrations to show they have been run?

Mar
28
3 months ago
Activity icon

Awarded Best Reply on Sorting A One To Many (Polymorphic) Relationship

Note to self: A and a might be the same on macOS, not on Linux. The issue was case sensitivity between the local system and centOS

Activity icon

Replied to Sorting A One To Many (Polymorphic) Relationship

Note to self: A and a might be the same on macOS, not on Linux. The issue was case sensitivity between the local system and centOS

Activity icon

Replied to Sorting A One To Many (Polymorphic) Relationship

Yup, I had tried that, making me think something is wrong elsewhere, I can get everything to display correctly a number of ways but never manage to get the sort order for some reason. Will go back to the start.

Activity icon

Started a new Conversation Sorting A One To Many (Polymorphic) Relationship

So I have been playing around with the structure of a new comment system for my blog using Polymorphic relationships. It all works fine but I am having trouble sorting the comments.

For example, here I get what I need through the controller and pass to the view.

$post = BlogPosts::with('BlogCategories', 'Users', 'BlogTags', 'Comments')->where('slug', $slug)->first();

I tried using

$post = BlogPosts::with(['Comments' => function($query) {
          $query->orderBy('created_at', 'DESC');
          }])->with('BlogCategories', 'Users', 'BlogTags')
   ->where('slug', $slug)->first();

Which still returns the right information but the comments are still not sorting in desc order.

Any ideas? I am sure I am missing something obvious to others.

Thanks

Mar
15
3 months ago
Activity icon

Replied to Passing API Data Back To View

Sorted it, it was an issue with the way the data from the API was being passed, nothing to do with Laravel.

Mar
14
3 months ago
Activity icon

Replied to Passing API Data Back To View

So, yes I have other data being passed into the view, so if I call the view directly it will return an error as that initial data is not passed to it.

This works fine on one server that has 3 websites:

return redirect()->action('Admin\[email protected]', ['result' => $result]);

However, on the other server with 7 sites I get a 502 bad gateway, I suspect there is too much data being passed in the URL doing it that way.

Activity icon

Replied to Passing API Data Back To View

Well, at this stage the data I need is in $result as an array, so I thought this would work.

return redirect()->action('Admin\[email protected]', $result);

But nothing and a few variations of this appear to put the data in. I am passing it back through the ServerController as I could not find a workable solution for anything else.

Activity icon

Started a new Conversation Passing API Data Back To View

Hi,

I am experimenting with an API (DirectAdmin), I have a view to select a server which then calls a method in the ServerController and runs the following.

$sock->query('/CMD_API_ALL_USER_USAGE');
$result = $sock->fetch_body();
$result = explode("\n", $result);

That does exactly what it is supposed to do and returns multiple rows of data like this example. ( there is a lot, this is just a small sample of one row):

[ 
    "testuser=bandwidth=7.05128000&creator=adminuser&date_created=1582530762&
    default=test.com&email_daily_limit=1000&email_deliveries_outgoing=0&inode=1492 ",
]

What I want to do now is send this data straight back to the view where I can output it in some way. But when I try to send the data in $result back I either get a bad gateway or simply no data at all, that I can tell.

This is just a personal project, I admit I am not great with this kind of thing and it is probably a simple task, just not sure what I am missing.

Any help appreciated

Mar
08
4 months ago
Activity icon

Replied to Overriding Editor Styles

Figured it out, it was all in the way you set up the editor, the default settings were getting in the way of my custom CSS settings.

Activity icon

Started a new Conversation Overriding Editor Styles

Hi,

I need a new WYSIWYG editor for my site and trying out Summernote but struggling with styling. For example;

If I create some normal text in the editor and save it, then I use blade to output like this

<p>{!! $text !!}</p>

Now that works absolutely fine and displays as it should.

But I want to be able to override the styles that were set by the editor, in the test all I wanted to was change the font size of the text but I can't figure out how or if there is a way to directly target '$text' in order to override it.

Does anyone have any ideas?

Thanks