Batch

Batch

Member Since 8 Months Ago

Experience Points
1,200
Total
Experience

3,800 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
7
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.

Level 1
1,200 XP
May
22
6 days ago
Activity icon

Started a new Conversation Eloquent Select For Three HasMany Relations

My models are below:

Organization:

class Organization extends Model
{
    public function departments()
    {
        return $this->hasMany('App\Department');
    }
}

Departments:

class Department extends Model
{
    public function organization()
    {
        return $this->belongsTo('App\Organization');
    }

    public function units()
    {
        return $this->hasMany('App\Unit');
    }
}

Units:

class Unit extends Model
{
    public function department()
    {
        return $this->belongsTo('App\Department');
    }
}

Organizations have many departments. Departments have many units.

I want to select all units under a specific organization. How can I achive this?

I tried below query but it didn't work:

\App\Organization::find(1)->departments()->units
Apr
27
1 month ago
Activity icon

Replied to Passport VueJS Components Not Working

It worked!

I run @MaverickChan s commands and it worked.

Thanks everybody.

Activity icon

Replied to Passport VueJS Components Not Working

Now I tried it too.

D:\wamp64\wwwl\sso\passportdnm2>npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

audited 18014 packages in 6.884s

34 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
D:\wamp64\wwwl\sso\passportdnm2>npm run dev

> @ dev D:\wamp64\wwwl\sso\passportdnm2
> npm run development


> @ development D:\wamp64\wwwl\sso\passportdnm2
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

98% after emitting SizeLimitsPlugin

 ERROR  Failed to compile with 1 errors                                                                       7:17:58 PM

This dependency was not found:

* vue in ./resources/js/app.js

To install it, you can run: npm install --save vue
       Asset     Size   Chunks             Chunk Names
/css/app.css  0 bytes  /js/app  [emitted]  /js/app
  /js/app.js  706 KiB  /js/app  [emitted]  /js/app

ERROR in ./resources/js/app.js
Module not found: Error: Can't resolve 'vue' in 'D:\wamp64\wwwl\sso\passportdnm2\resources\js'
 @ ./resources/js/app.js 3:13-27
 @ multi ./resources/js/app.js ./resources/sass/app.scss
Activity icon

Replied to Passport VueJS Components Not Working

@mvd

I get below error:

ERROR in ./resources/js/app.js
Module not found: Error: Can't resolve 'vue' in 'D:\wamp64\wwwl\sso\passportdnm2\resources\js'
 @ ./resources/js/app.js 3:13-27
 @ multi ./resources/js/app.js ./resources/sass/app.scss
Activity icon

Started a new Conversation Passport VueJS Components Not Working

I created a new laravel application and followed below tutorials to configure passport:

https://laracasts.com/series/whats-new-in-laravel-5-3/episodes/13 https://laravel.com/docs/7.x/passport#introduction

When I go to http://localhost/passportdnm2/public/home I don't see any vuejs components.

Also firefox console gives this error:

ReferenceError: Vue is not definedapp.js:19286:1
    js http://localhost.com/passportdnm2/public/js/app.js:19286
    __webpack_require__ http://localhost.com/passportdnm2/public/js/app.js:20
    0 http://localhost.com/passportdnm2/public/js/app.js:19345
    __webpack_require__ http://localhost.com/passportdnm2/public/js/app.js:20
    <anonim> http://localhost.com/passportdnm2/public/js/app.js:84
    <anonim> http://localhost.com/passportdnm2/public/js/app.js:87

How can I fix this?

My Laravel version is: 7.8.1

My artisan steps are below:

  1. composer require laravel/passport
  2. php artisan migrate
  3. php artisan passport:install
  4. php artisan vendor:publish --tag=passport-components
  5. composer require laravel/ui
  6. php artisan ui:auth
  7. npm run dev

User.php:

<?php

namespace App;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Passport\HasApiTokens;

class User extends Authenticatable
{
    use HasApiTokens, Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];
}

AuthServiceProvider.php:

<?php

namespace App\Providers;

use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
use Laravel\Passport\Passport;

class AuthServiceProvider extends ServiceProvider
{
    /**
     * The policy mappings for the application.
     *
     * @var array
     */
    protected $policies = [
        // 'App\Model' => 'App\Policies\ModelPolicy',
    ];

    /**
     * Register any authentication / authorization services.
     *
     * @return void
     */
    public function boot()
    {
        $this->registerPolicies();

        Passport::routes();
    }
}

auth.php:

...
    'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],

        'api' => [
            'driver' => 'passport',
            'provider' => 'users',
        ],
    ],
...

resources\js\app.js:

require('./bootstrap');

Vue.component(
    'passport-clients',
    require('./components/passport/Clients.vue').default
);

Vue.component(
    'passport-authorized-clients',
    require('./components/passport/AuthorizedClients.vue').default
);

Vue.component(
    'passport-personal-access-tokens',
    require('./components/passport/PersonalAccessTokens.vue').default
);


const app = new Vue({
    el: 'body'
});

resources\views\home.blade.php:

@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">Dashboard</div>

                <div class="card-body">
                    @if (session('status'))
                        <div class="alert alert-success" role="alert">
                            {{ session('status') }}
                        </div>
                    @endif

                    <passport-clients></passport-clients>
                    <passport-authorized-clients></passport-authorized-clients>
                    <passport-personal-access-tokens></passport-personal-access-tokens>


                    You are logged in!
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

Apr
26
1 month ago
Activity icon

Started a new Conversation Passport VueJS Components Not Working

I created a new laravel application and followed below tutorials to configure passport:

https://laracasts.com/series/whats-new-in-laravel-5-3/episodes/13 https://laravel.com/docs/7.x/passport#introduction

When I go to http://localhost/passportdnm2/public/home I don't see any vuejs components.

Also firefox console gives this error:

ReferenceError: Vue is not definedapp.js:19286:1
    js http://localhost.com/passportdnm2/public/js/app.js:19286
    __webpack_require__ http://localhost.com/passportdnm2/public/js/app.js:20
    0 http://localhost.com/passportdnm2/public/js/app.js:19345
    __webpack_require__ http://localhost.com/passportdnm2/public/js/app.js:20
    <anonim> http://localhost.com/passportdnm2/public/js/app.js:84
    <anonim> http://localhost.com/passportdnm2/public/js/app.js:87

How can I fix this?

My Laravel version is: 7.8.1

My artisan steps are below:

  1. composer require laravel/passport
  2. php artisan migrate
  3. php artisan passport:install
  4. php artisan vendor:publish --tag=passport-components
  5. composer require laravel/ui
  6. php artisan ui:auth
  7. npm run dev

User.php:

<?php

namespace App;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Passport\HasApiTokens;

class User extends Authenticatable
{
    use HasApiTokens, Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];
}

AuthServiceProvider.php:

<?php

namespace App\Providers;

use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
use Laravel\Passport\Passport;

class AuthServiceProvider extends ServiceProvider
{
    /**
     * The policy mappings for the application.
     *
     * @var array
     */
    protected $policies = [
        // 'App\Model' => 'App\Policies\ModelPolicy',
    ];

    /**
     * Register any authentication / authorization services.
     *
     * @return void
     */
    public function boot()
    {
        $this->registerPolicies();

        Passport::routes();
    }
}

auth.php:

...
    'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],

        'api' => [
            'driver' => 'passport',
            'provider' => 'users',
        ],
    ],
...

resources\js\app.js:

require('./bootstrap');

Vue.component(
    'passport-clients',
    require('./components/passport/Clients.vue').default
);

Vue.component(
    'passport-authorized-clients',
    require('./components/passport/AuthorizedClients.vue').default
);

Vue.component(
    'passport-personal-access-tokens',
    require('./components/passport/PersonalAccessTokens.vue').default
);


const app = new Vue({
    el: 'body'
});

resources\views\home.blade.php:

@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">Dashboard</div>

                <div class="card-body">
                    @if (session('status'))
                        <div class="alert alert-success" role="alert">
                            {{ session('status') }}
                        </div>
                    @endif

                    <passport-clients></passport-clients>
                    <passport-authorized-clients></passport-authorized-clients>
                    <passport-personal-access-tokens></passport-personal-access-tokens>


                    You are logged in!
                </div>
            </div>
        </div>
    </div>
</div>
@endsection