Cyber Monday! Get 25% off for as long as you keep your subscription. New subscribers only.

James_Moore

James_Moore

Software Developer at Flex-N-Gate Corp.

Member Since 3 Years Ago

Windsor

Experience Points
48,380
Total
Experience

1,620 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
347
Lessons
Completed
Best Reply Awards
15
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 10
48,380 XP
Nov
18
1 week ago
Activity icon

Started a new Conversation Product Price Api

Just wondering if anyone knows of any free public apis to get product prices. Essentially any product say the price of a new PlayStation 5 or the price of a Nintendo switch.

The Best buy api currently isn't handing out api keys to public emails. Jeffery used it as a example in his stock tracker app videos.

Nov
08
3 weeks ago
Activity icon

Started a new Conversation CORS: Response To Preflight Request Doesn't Pass Access Control Check

error Access to XMLHttpRequest at url with creds goes here from origin 'http://garage-sailor.test' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.

Trying to hit a third party HERE api from my vue js app. Trying to look up CORs solutions is a bit of a rabbit hole. Just wondering if anybody has a clear solution to fixing this. Trying to hit the third party api from a vue component that sits in blade view.

composer.json

        "php": "^7.2.5",
        "alexpechkarev/google-maps": "^8.0",
        "fabpot/goutte": "^4.0",
        "fideloper/proxy": "^4.2",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.0.1",
        "laravel/framework": "^8.0",
        "laravel/legacy-factories": "^1.1",
        "laravel/tinker": "^2.0",
        "laravel/ui": "^3.0"
Nov
03
4 weeks ago
Activity icon

Replied to Process.env.MIX_GOOGLE_MAPS_KEY

ended up working

Activity icon

Started a new Conversation Process.env.MIX_GOOGLE_MAPS_KEY

I've seen online that there is a way to access env variables in vue using process.env.MIX_

Is this also available to use in the app.js

  1. Created env variable with mix prefix
  2. npm run dev
  3. console.log(process.env.MIX_GOOGLE_MAPS_KEY); in resources/app.js is undefined
Oct
22
1 month ago
Activity icon

Replied to <div> Margin Taking Up All Available Width

@laracoft I sadly cant share a screenshot on laracasts but, if you ctrl-shift-f the following

<div class="text-center mb-5" style="border: 1px solid black">
    <div>
        <a href="{{ $ad->path() }}"> {{$ad->name}} </a>
    </div>
    <div>
        <p>{{ $ad->description }}</p>

        <span>{{ $ad->origin }}</span>
    </div>
    <div>
        {{ $ad->location }}
    </div>
</div>

The partial is _ad.blade.php and youll notice in the chrome dev tools even with the w-25 all the divs sit on there own "row" I cant seem to see whats causing it.

Activity icon

Started a new Conversation <div> Margin Taking Up All Available Width

I cant figure out why this div has a margin let alone why its taking up all the available width in the container. The project and repo can be found here.

https://github.com/James-N-M/garage-sailor

This partial https://github.com/James-N-M/garage-sailor/blob/master/resources/views/_ad.blade.php

the div takes up the entire width of the goal would be for all the boxes to be next to each other.

Oct
19
1 month ago
Activity icon

Started a new Conversation Scraping Kijiji And FB Marketplace Data

The goal is to have a job run every X hours on my application that gets "garage sale" ad / classifieds ad data from sites like kijiji.ca or Facebook marketplace.

I'm seeking guidance on web scrapper packages that I can use, or third party api services that would also be of use. Thanks again !

Oct
03
1 month ago
Activity icon

Replied to Windows 10 With WSL2, Docker And Laravel (how To)

takeouts available on windows ?! or is it available through the linux setup with wsl ? Real excited to finally donate some time to setup a docker environment for our team. Were still all running vagrant / homestead.

Sep
24
2 months ago
Activity icon

Replied to CONFUSED ABOUT NODE JS AND PHP.

Of course, Laravel is a full stack framework you can make great applications using Laravel with little to no Javascript. Node JS is javascript but its javascript that can be run on the backend. Laravel uses the package manager npm which comes with node, to deal with its front end dependencies. React is a front end framework for Javascript, mongo is a document database. Laracasts tutorials will usually use a simple mysql database and Vue JS instead of React.

Start slow following a laracasts tutorial to get a understanding of some php basics

  1. https://laracasts.com/series/php-for-beginners learn some php

  2. Build something small with php, google php project ideas

  3. https://laracasts.com/series/laravel-6-from-scratch

  4. Build something with Laravel

By then you'll have idea of what's going on and realize why you dont need to learn node js to build something great, but with that being learning any language has its benefits. As long as your building projects thats all that matters.

Sep
14
2 months ago
Activity icon

Replied to Return View Dost'nt Work

@hendrasaputra2323 I noticed this could be breaking it. @foreach ($errors-> all(); as $error)

Sep
13
2 months ago
Activity icon

Replied to Best Practice To Handle Many Relationships

Perhaps you should be splitting up your model into other models, might be a sign you should have other tables. Or take generic relationships such as “commentable” “likeable” related things and move them into traits.

Sep
08
2 months ago
Activity icon

Started a new Conversation Windows Wsl Docker Development Environment Setup

https://twitter.com/stauffermatt/status/1302773542791114754?s=21

Recently the following tweet got brought up in our slack dev team channel. Our team has been using homestead for our development environments for quite some time now, its very slow for some and fast for others. I'm curious about trying something else and the WSL with docker seems to be the most popular choice.

Can anyone point me in the direction of a tutorial to set this up for Laravel on windows. I have 0 docker experience and could use a place to start.

Jul
31
4 months ago
Activity icon

Replied to Show Notification For Comments And Topics

Hey @browniecoffee I'm not sure if this will help but check out https://laracasts.com/series/get-real-with-laravel-echo the first few videos should help you out.

Activity icon

Awarded Best Reply on How Push Form Data To Multiple Models?

Hey @loyd you could perform some curl requests in your register controllers to also call other controllers to also update your profile model. I dont thinkk this is good practise though

I'm not sure if your working with an existing code base or starting a fresh project. But why not have your profiles reflect your user model instead. Add the username to your users migration, and make a controller such as..

<?php

namespace App\Http\Controllers;

use App\User;
use Illuminate\Validation\Rule;

class ProfilesController extends Controller
{
    public function show(User $user)
    {
        return view('profiles.show', [
            'user' => $user,
            'tweets' => $user
                ->tweets()
                ->withLikes()
                ->paginate(50),
        ]);
    }

    public function edit(User $user)
    {
        $this->authorize('edit', $user);

        return view('profiles.edit', compact('user'));
    }

    public function update(User $user)
    {
        $this->authorize('edit', $user);

        $attributes = request()->validate([
            'username' => [
                'string',
                'required',
                'max:255',
                'alpha_dash',
                Rule::unique('users')->ignore($user),
            ],
            'name' => ['string', 'required', 'max:255'],
            'description' => ['string', 'required', 'max:255'],
            'avatar' => ['image'],
            'email' => [
                'string',
                'required',
                'email',
                'max:255',
                Rule::unique('users')->ignore($user),
            ],
            'password' => [
                'string',
                'required',
                'min:8',
                'max:255',
                'confirmed',
            ],
        ]);

        if (request('avatar')) {
            $attributes['avatar'] = request('avatar')->store('avatars');
        }

        $user->update($attributes);

        return redirect($user->path())->with('flash', 'Success! profile updated');
    }
}

with views,

views/profiles/edit.blade.php
Activity icon

Replied to Best Way To Store Code Snippets In Laravel (database, Storage Engine, Etc)

I believe just storing as text and using a front end package like https://highlightjs.org/ for instance should be fine !

Activity icon

Awarded Best Reply on Best Way To Store Code Snippets In Laravel (database, Storage Engine, Etc)

Hey @adxmcollins

https://laracasts.com/series/how-do-i/episodes/13 Two parts Jeffery creates a similar application.

In your scripts or snippets table migration, the following should work fine. $table->text('body');

Then check out


    <div class="card-body">
        <pre class="p-2"><code>{{$snippet->body}}</code></pre>
    </div>

I believe the classes are just bootstrap css, I made a similar project a while back that I never finished. https://github.com/James-N-M/script-snips

Jul
30
4 months ago
Activity icon

Replied to Best Way To Store Code Snippets In Laravel (database, Storage Engine, Etc)

Hey @adxmcollins

https://laracasts.com/series/how-do-i/episodes/13 Two parts Jeffery creates a similar application.

In your scripts or snippets table migration, the following should work fine. $table->text('body');

Then check out


    <div class="card-body">
        <pre class="p-2"><code>{{$snippet->body}}</code></pre>
    </div>

I believe the classes are just bootstrap css, I made a similar project a while back that I never finished. https://github.com/James-N-M/script-snips

Jul
26
4 months ago
Activity icon

Replied to When Redirecting Back After Mail Sent In Test 302 Status Code

Thanks @bobbybouwmann really liked your Laracon EU talk !

Jul
25
4 months ago
Activity icon

Started a new Conversation When Redirecting Back After Mail Sent In Test 302 Status Code

I have the following test


    /** @test */
    public function an_authenticated_user_can_email_an_ad_creator()
    {
	// Given
        \Mail::fake();

        \Mail::assertNothingSent();

        $ad = factory(Ad::class)->create();

        $creator = $ad->creator;

        $this->signIn();
	
	// When
        $this->post("/contact/ads/{$ad->id}", ['body' => "Hello are you selling any golf clubs"])->assertSuccessful();
	
	// Then
        \Mail::assertSent(ContactAdCreator::class, function ($mail) use ($creator) {
            return $mail->hasTo($creator->email);
        });
    }

Controller

class ContactAdCreatorController extends Controller
{
    public function store(Ad $ad)
    {
        request()->validate(['body' => 'required']);

        Mail::to($ad->creator->email)
            ->send(new ContactAdCreator(request()->body));

        return redirect()->back()
            ->with(['message' => 'Email sent!']);
    }
}

When I include the block

return redirect()->back()
->with(['message' => 'Email sent!']);

The test fails why ?

Jul
15
4 months ago
Activity icon

Replied to Basic Drop Down

    public function index()
    {
	$products = Product::all();
	
	$selectedProduct = 2;
	
	return view('main', compact('products', 'selectedProduct')); // assuming main view is views/main.blade.php
    }
<select name="myselect">
<option> </option>
  @foreach ($products as $product)
    <option value="{{ $product->id }}" {{ ( $product->id == $selectedProduct) ? 'selected' : '' }}> {{ $product->name }} </option>
  @endforeach 
</select>
Jul
09
4 months ago
Activity icon

Started a new Conversation Deleted Vendor Folder Composer Install Fails

I'm having a hard time deciphering what composer is trying to tell me. I deleted my Laravel applications vendor folder, my app has a packages directory with a package im working on.

Problem 1
    - Conclusion: don't install laravel/framework v7.19.0
    - Conclusion: don't install laravel/framework v7.18.0
    - Conclusion: don't install laravel/framework v7.17.2
    - Conclusion: don't install laravel/framework v7.17.1
    - Conclusion: don't install laravel/framework v7.17.0
    - Conclusion: don't install laravel/framework v7.16.1
    - Conclusion: don't install laravel/framework v7.16.0
    - Conclusion: don't install laravel/framework v7.15.0
    - Conclusion: don't install laravel/framework v7.14.1
    - Conclusion: don't install laravel/framework v7.14.0
    - Conclusion: don't install laravel/framework v7.13.0
    - Conclusion: don't install laravel/framework v7.12.0
    - Conclusion: don't install laravel/framework v7.11.0
    - Conclusion: don't install laravel/framework v7.10.3
    - Conclusion: don't install laravel/framework v7.10.2
    - Conclusion: don't install laravel/framework v7.10.1
    - Conclusion: don't install laravel/framework v7.10.0
    - Conclusion: don't install laravel/framework v7.9.2
    - Conclusion: don't install laravel/framework v7.9.1
    - Conclusion: don't install laravel/framework v7.9.0
    - Conclusion: don't install laravel/framework v7.8.1
    - Conclusion: don't install laravel/framework v7.8.0
    - Conclusion: don't install laravel/framework v7.7.1
    - Conclusion: don't install laravel/framework v7.7.0
    - Conclusion: don't install laravel/framework v7.6.2
    - Conclusion: don't install laravel/framework v7.6.1
    - Conclusion: don't install laravel/framework v7.6.0
    - Conclusion: don't install laravel/framework v7.5.2
    - Conclusion: don't install laravel/framework v7.5.1
    - Conclusion: don't install laravel/framework v7.5.0
    - Conclusion: don't install laravel/framework v7.4.0
    - Conclusion: don't install laravel/framework v7.3.0
    - Conclusion: don't install laravel/framework v7.2.2
    - Conclusion: don't install laravel/framework v7.2.1
    - Conclusion: don't install laravel/framework v7.2.0
    - Conclusion: don't install laravel/framework v7.1.3
    - Conclusion: don't install laravel/framework v7.1.2
    - Installation request for james-n-m/lara-quiz dev-master -> satisfiable by james-n-m/lara-quiz[dev-master].
    - Conclusion: don't install laravel/framework v7.1.1
    - Conclusion: don't install laravel/framework v7.1.0
    - james-n-m/lara-quiz dev-master requires illuminate/support ^6.0 -> satisfiable by illuminate/support[6.x-dev, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.10.0, v6.11.0, v6.12.0, v6.13.0, v6.13.1, v6.14.0, v6.15.0, v6.15.1, v6.16.0, v6.17.0, v6.17.1, v6.18.0, v6.18.1, v6.18.10, v6.18.11, v6.18.12, v6.18.13, v6.18.14, v6.18.15, v6.18.16, v6.18.17, v6.18.18, v6.18.19, v6.18.2, v6.18.20, v6.18.21, v6.18.22, v6.18.23, v6.18.24, v6.18.3, v6.18.4, v6.18.5, v6.18.6, v6.18.7, v6.18.8, v6.18.9, v6.2.0, v6.3.0, v6.4.1, v6.5.0, v6.5.1, v6.5.2, v6.6.0, v6.6.1, v6.6.2, v6.7.0, v6.8.0].
    - don't install illuminate/support 6.x-dev|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.0.0|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.0.1|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.0.2|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.0.3|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.0.4|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.1.0|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.10.0|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.11.0|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.12.0|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.13.0|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.13.1|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.14.0|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.15.0|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.15.1|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.16.0|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.17.0|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.17.1|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.0|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.1|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.10|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.11|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.12|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.13|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.14|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.15|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.16|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.17|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.18|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.19|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.2|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.20|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.21|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.22|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.23|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.24|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.3|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.4|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.5|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.6|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.7|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.8|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.18.9|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.2.0|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.3.0|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.4.1|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.5.0|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.5.1|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.5.2|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.6.0|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.6.1|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.6.2|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.7.0|don't install laravel/framework 7.x-dev
    - don't install illuminate/support v6.8.0|don't install laravel/framework 7.x-dev
    - Installation request for laravel/framework ^7.1 -> satisfiable by laravel/framework[7.x-dev, v7.1.0, v7.1.1, v7.1.2, v7.1.3, v7.10.0, v7.10.1, v7.10.2, v7.10.3, v7.11.0, v7.12.0, v7.13.0, v7.14.0, v7.14.1, v7.15.0, v7.16.0, v7.16.1, v7.17.0, v7.17.1, v7.17.2, v7.18.0, v7.19.0, v7.2.0, v7.2.1, v7.2.2, v7.3.0, v7.4.0, v7.5.0, v7.5.1, v7.5.2, v7.6.0, v7.6.1, v7.6.2, v7.7.0, v7.7.1, v7.8.0, v7.8.1, v7.9.0, v7.9.1, v7.9.2].
Jul
06
4 months ago
Activity icon

Replied to Merge Multiple HasMany

You can pass an array of relationships to the with method.

Eager Loading Multiple Relationships

$books = App\Book::with(['author', 'publisher'])->get();

Jun
30
5 months ago
Activity icon

Replied to Mermaid For Laravel

Being that its a java script library, sounds like you would want to wrap It in a VUE JS way ? Or perhaps a Laravel package that comes with some views etc. If it hasn't been done already I'd be interested in contributing I have some package development experience. Find me on github infos there !

Jun
24
5 months ago
Activity icon

Awarded Best Reply on Help With A Loop In Blade

@foreach($items->chunk(2) as $chunk)
<div class="row"> {--  THIS IS THE MISSING DIV --}
		<div class="col-lg-6">
			<article>
				// something like this perhaps $chunk[0]; 
			</article>
		</div>
		<div class="col-lg-6">
			<article>
 				// something like this perhaps $chunk[1]; 
			</article>
		</div>
</div> {--  THIS IS THE MISSING DIV CLOSE--}
@endforeach
Jun
22
5 months ago
Activity icon

Replied to Help With A Loop In Blade

@foreach($items->chunk(2) as $chunk)
<div class="row"> {--  THIS IS THE MISSING DIV --}
		<div class="col-lg-6">
			<article>
				// something like this perhaps $chunk[0]; 
			</article>
		</div>
		<div class="col-lg-6">
			<article>
 				// something like this perhaps $chunk[1]; 
			</article>
		</div>
</div> {--  THIS IS THE MISSING DIV CLOSE--}
@endforeach
Jun
12
5 months ago
Activity icon

Replied to Want Get Api Data Of Weather With The Help Of .csv Link

Hi @me10071990 may you post your code of this being done in php, then I can recommend a way (I'm sure theres several) to do this in laravel.

Activity icon

Replied to Increment A Value In DB

Hey @mastermindlegion I'm a little confused at this

$event->article->increment('views', 1); // why $event->article arent you passing the article

I also off the top of my head cant remember how Laravel events work. anyways !

$article->increment('views', 1);
// dd($article); // confirm the increment happens 
$article->save(); // persist the change to the database