NickCourage

Member Since 8 Months Ago

Experience Points
950
Total
Experience

4,050 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.

  • Community Pillar

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

Level 1
950 XP
Jan
18
5 days ago
Activity icon

Replied to Are These The Correct Model Relationships And Table Structures?

As part of another task/relationship for this yes, but even without that felt this was necessary so that the same Travel Route could be associated with more than one Employee. It's also not an option to include the route_id in the employee's table either

Activity icon

Started a new Conversation Are These The Correct Model Relationships And Table Structures?

Just want to sense check what I'm using for this scenario and get some feed back.

An employee with a role of delivery driver only ever has one travel route but a travel route can have multiple delivery drivers.

I have an employees, routes and employee_routes table. An Employee belongs to one EmployeeRoute, many Routes belongs to many EmployeeRoute.

My Model relationships looks like:

Employee.php

    public function employeeRoute()
    {
        return $this->hasOne(Route::class);
    }

Route.php

    public function employeeRoutes()
    {
        return $this->hasMany(EmployeeRoutes::class);
    }

EmployeeRoute.php

    public function employee()
    {
        return $this->belongsTo(employee::class);
    }

    public function routes()
    {
        return $this->belongsTo(Route::class);
    }

Does this look right to you?

Nov
18
2 months ago
Activity icon

Replied to Creating And Consuming An API Service Within Laravel

I appreciate the info and insight - thank you. Inertia certainly seems to deal with the upside of why we would use an SPA/API driven microservice approach without the overhead and is quite blatant about the fact that it is monolithic - I like that. The demo app "PingCRM" really shows it off nicely and is exactly the kind of thing I'm interested in.

For a while, I got stuck into a way of thinking that put me off of building anything that wasn't API driven or didn't use a microservice architecture and quickly realized how thinly I would be spread as a soloist developer for my development endeavours.

Unless we're talking about building a unique platform like Twitter, Stackoverflow, etc that needs to scale vertically instead of horizontally, where like you say, there are those dedicated teams and abundant resources for individual aspects of development I realized it added a lot more depth to the things I just didn't (and still don't fully) know i.e. the added complexities of authorization, storage, AWS/Azure integration, etc.

I'll checkout Livewire and noticed that this and Intertia ships with Laravel 8 - something I haven't yet really exposed myself to as I'm still working with Laravel 6. The reason for this is that it's the most up to date LTS release and where I work, unless a 3rd party framework has an LTS version, we won't use it in a production environment and thought that was a good quality standard to follow for myself.

All the best Rodrigo

Activity icon

Replied to Creating And Consuming An API Service Within Laravel

@rodrigo.pedra Thank you Rodrigo - Inertia seems to fit alot of what I've described there so will be investigating it in detail. Thanks for the reply

Activity icon

Started a new Conversation Creating And Consuming An API Service Within Laravel

I would like to make an application I'm working on API driven and I understand that I could create this as a RESTful API service and then create a separate SPA to consume it. But what if I wanted to make this in a monolithic way where I used a mixture of Vue components, HTML, and blade templates for the views, etc within a single Laravel application?

Rather than follow what I guess is the traditional way i.e. create routes in web.php, reference the endpoints of those routes to a method in a respective controller, etc but what I'm trying to get my head around is how I could do this with the api.php routes and endpoints where I would just be serving responses that would contain JSON data, etc and how could I then implement these to use views as well?

Would I use api.php routes for the JSON response data and web.php routes for defining what views are returned? If so, how? Or, as this is all meant to be contained within a single Laravel application, just stick to using web.php?

Nov
14
2 months ago
Activity icon

Started a new Conversation How Do I Give An <option> Element A Selected Attribute In VueJS?

<select class="form-control" v-bind:class="{ 'is-invalid' : errors.category_id }" v-model="product.category_id">
    <option v-for="category in categories" :selected="category.id ? true : false" :value="category.id">{{ category.name }}</option>
</select>

I've tried :selected="product.category_id == category.id ? true : false " and have done alot of searching but can't find anything to answer what I thought would be a simple problem

Oct
30
2 months ago
Activity icon

Started a new Conversation How Do I Stop A User From Accessing My Laravel API Like A Normal Website?

I'm trying to create a microservice driven, hello-world app that uses Laravel as the backend (api) and VueJS for the front end to consume it. I'm unsure of how I would even deploy this yet but one thing I've picked up on is that while Laravel serves as the backend and I can interact with it through the frontend, if a user goes to the host of the Laravel app, they can still register, login and click on the default splash page from a fresh install, etc...How would I stop that from happening so that only the frontend (which is on a different host/port) is what a user can access?

Oct
09
3 months ago
Activity icon

Replied to How Do I Get My Custom, Local Laravel Package Into The Vendor Directory?

@automica so if I was to update the package in my package directory and run the composer command again, this would also be updated in the vendor directory?

Activity icon

Replied to How Do I Get My Custom, Local Laravel Package Into The Vendor Directory?

Laughably, I thought about doing that but just assumed omitting it would be the same thing. That'll teach me! Thank you.

Activity icon

Started a new Conversation How Do I Get My Custom, Local Laravel Package Into The Vendor Directory?

Of course, I could just mv it there but I am wondering if from my root directory where I have ./packages/my-name/my-package if it can be placed there (not just a symlink) when I run composer require? In the same way that packages from packagist are placed in the vendor directory, how can my custom, local packages end up there (the actual directories and files rather than just the symlink) when I run composer require?

As strange as this sounds, I'd ideally have duplicates i.e. package 1 in my root/packages directory and the same again in my vendor directory which is what the app will use.

Sep
21
4 months ago
Activity icon

Replied to How Do I Dockerise This Cloned Laravel App?

@martinbean Interesting because where I work we have our docker folders outside of our app directories. For example, the laravel app would be in a directory named quickstart-intermediate and the docker setup would be in an adjacent directory called quickstart-intermediate-docker, and for the purpose of learning tried to recreate this.

Sep
20
4 months ago
Activity icon

Replied to How Do I Dockerise This Cloned Laravel App?

@martinbean could I include a move/copy command to transfer it to quickstart-intermediate-docker first?

Activity icon

Replied to How Do I Dockerise This Cloned Laravel App?

@martinbean Thanks for your reply - I've tried this and can't get it working. I have two directories, one called quickstart-intermediate the other called quickstart-intermediate-docker.

quickstart-intermediate-docker contains my docker-compose.yml file and Dockerfile and is where I called docker-compose up -d from where I also reference the volumes for the file and dirs of quickstart-intermediate. So I'm struggling to get it to reference the composer.json and composer.lock files in quickstart-intermediate from there and keep getting copy failed: forbidden path outside the build context

Activity icon

Started a new Conversation How Do I Dockerise This Cloned Laravel App?

I know this is more to with Docker than Laravel but this question is specific to Laravel as I need to run composer update to install the vendor dependencies of the quickstart-intermediate demo app provided by Laravel.

my docker-compose.yml file:

version: '3'

networks:
    laravel:

services:
    nginx:
        image: nginx:stable-alpine
        container_name: nginx
        ports:
            - "8088:80"
        volumes:
            - ../quickstart-intermediate:/var/www/html
            - ./nginx/default.conf:/etc/nginx/conf.d/default.conf
        depends_on:
            - php
            - mysql
        
        networks:
            - laravel
    mysql:
        image: mysql:5.7.22
        container_name: mysql
        restart: unless-stopped
        tty: true
        ports:
            - "4306:3306"
        volumes:
            - ./mysql:/var/lib/mysql
        environment: 
            MYSQL_DATABASE: homestead
            MYSQL_USER: homestead
            MYSQL_PASSWORD: secret
            MYSQL_ROOT_PASSWORD: root

            SERVICE_TAGS: dev
            SERVICE_NAME: mysql
        networks: 
            - laravel
    
    php:
        build:
            context: .
            dockerfile: Dockerfile
        container_name: php
        volumes:
            - ../quickstart-intermediate:/var/www/html
        ports:
            - "9000:9000"
        networks:
            - laravel

my Dockerfile:

FROM php:7.2-fpm-alpine

RUN docker-php-ext-install pdo pdo_mysql

I can get it working by manually executing composer update in the project directory as I also have composer installed globally but don't know how I could do this with Docker alone. I've done plenty of searching and will continue to but can't find anything that answers this issue.

Jul
23
6 months ago
Activity icon

Replied to How Can I Use AJAX To Get A List Of Records In The View For A JQuery Array?

@jlrdw thank you - it didn't solve it for me but I don't think I would have cracked it without that point in the right direction. I got there with:

        url = "{{route('test')}}";

        $.ajax({
            url: url,
            type:'get',
            dataType:'json',
            success:function (data) {
                
                $.each(data, function (index, item) {
                
                    return dataTitle = item.map(function(item){ return item; });

                }) 

            }
        });

and was then able to access them based on the selection of a dropdown by accessing dataTitle.

Thanks!

Jul
21
6 months ago
Activity icon

Started a new Conversation How Can I Use AJAX To Get A List Of Records In The View For A JQuery Array?

I'm trying to populate a jQuery array with the values from a column of a table. I tried:

var dataTitle = {!! json_encode(array_column($dataTitles->toArray(), 'my_data_title')) !!}

I now want to use ajax to do this. I've created a route that references a function in the controller and returns the data in JSON:

    public function getDataTitles(){

        $dataTitles = DataTitle::all();

        return response()->json(['data' => $dataTitles]);


    }

I've create the route for it to use as the URL parameter and have tried:

url = "{{route('get-data-titles')}}";

$.ajax({
    url: url,
    type:'get',
    dataType:'json',
    success:function (response) {

        console.log(data)
    }
})     

but am getting nothing. I've spent some time trying to Google and search for similar examples I can use but so far haven't found anything