YeZawHein

YeZawHein

Member Since 1 Year Ago

Experience Points
56,760
Total
Experience

3,240 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
499
Lessons
Completed
Best Reply Awards
9
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.

Level 12
56,760 XP
Oct
08
1 week ago
Activity icon

Replied to Cant Find Carbon In View

 {{ \Carbon\Carbon::parse($post->publish_date)->format('M.d.Y') }}
Oct
07
1 week ago
Activity icon

Replied to Undefined Variable: MasterStockist

@forelse($masterStockist as $ms)
<tr> 
//your code
</tr>
@empty
<td>There is no master stock list </td>
@endforelse
Sep
30
2 weeks ago
Activity icon

Replied to Help With Understanding Laravel Passport

When the user logged in passport can generate access token.One user One token.User can access authenticated routes until access token expired.

Sep
27
3 weeks ago
Activity icon

Replied to Refactor If Statement

Yikes! You haven't name in roles table?

{{ $user->role->name }}
Sep
23
3 weeks ago
Activity icon

Replied to Passport Grant Token - Expires_in

@saantty44 Try this one

public function boot()
{
    $this->registerPolicies();

    Passport::routes();
    Passport::personalAccessTokensExpireIn(now()->addMinutes(10));
      
}
Sep
11
1 month ago
Activity icon

Replied to HasManyThrough Relation Implementation Help Need

I think you won't need 3 tables.

Users

id
name
---
---
role_id (may be supplier and customer)
parent_id ( may be this user(customer or supplier)  has parent customer id and default 0 )

Roles (O-M relation with users)

id
name (can be supplier and customer)
Sep
09
1 month ago
Activity icon

Replied to More Cleaner Way

Why don't use conditional statement in blade?

Sep
02
1 month ago
Activity icon

Replied to Image Not Display In Laravel 5.7

Hey you can use storage directory command. php artisan storage:link documentation.That's create an absolute link under public from storage/app/public.

Activity icon

Replied to Image Not Display In Laravel 5.7

asset() generates a url for javascript,css and images in under public directory directly.For example

{{asset('images/something.jpg')}}
Aug
31
1 month ago
Activity icon

Replied to How To Update All Option ?

@van1310 what relationship do you have between these tables?

Aug
30
1 month ago
Aug
16
2 months ago
Activity icon

Replied to Cannot Access Attributes Of A Model In View.

@azoraqua Ok So try to change column name author to author_id.You can't have them be the same name because the relationship will never be returned if a column is found with that name.

Activity icon

Replied to Cannot Access Attributes Of A Model In View.

I think this post already doesn't have author.You can try this

<li class="small"><a href="#" class="text-dark font-weight-bolder">
    {{ $post->author->name ? $post->author->name:'This post doesn't have author' }}
</a></li>
Aug
13
2 months ago
Activity icon

Replied to Index View Isn't Showing

@alphadev your route will not reach front_design.blade.Try this something like that

 public function index()
      {
           return view('layouts.frontLayout.front_design');
      }
Aug
09
2 months ago
Activity icon

Replied to V-for Issue

You already defined services in data?Something like that....

data(){
    return{
    services: [],
}
},
methods:{
    getServices() { 
                axios.get('/api/services/get')
                .then(response => {
                    this.services = response.data;
                })
            },
}
Aug
03
2 months ago
Activity icon

Replied to ArgumentCountError In Laravel 5.8

Did you correctly passed $provider in front end form action?

Jul
25
2 months ago
Activity icon

Replied to Alternative To Paginate On Collection?

@azoruk If you seriously want paginate on collection , this dude made awesome solution using macro.GitHub.

Activity icon

Replied to Passport Token Is Still Valid After Revocation (even Deletion)?

Why not use postman?This logout function perfectly work when i test with postman.

Jul
22
2 months ago
Activity icon

Replied to SQL Cannot Add Forign Key

Try with bigInteger.

Jul
18
3 months ago
Activity icon

Replied to Composer Requirements Conflict

maatwebsite/excel: "~2.1.0" doesn't support for laravel 5.8.

Jul
09
3 months ago
Activity icon

Replied to Laravel Passport Tables

That's why passport have refresh_tokens.Your access_tokens should be short_lived expiration time because this will make more secure authentication.If your short-live access_token has stolen,the attacker can't accept your account longer.When access_tokens expired, you can regenerate new access_tokens using refresh_tokens.

Jul
05
3 months ago
Activity icon

Replied to Can't Connect To Algolia .

SCOUT_QUEUE defaut is false in scout.php.Your should change SCOUT_QUEUE = true in .env.

Activity icon

Replied to Dynamic Arguments Not Working.

v-bind:href="url"
Jun
13
4 months ago
Activity icon

Replied to Problem With V-model On Message Input & IsTyping Indicator

I believe that one conversation will have many messages.So I suggest that way.Never mind :)

Activity icon

Replied to Problem With V-model On Message Input & IsTyping Indicator

i think this error will be in v-for

 <li class="media" v-for="(value, index) in conversations.message" :key="index">
  {{value}}
</li>
Activity icon

Replied to Problem With V-model On Message Input & IsTyping Indicator

@theunforgiven you can do this

store(){
            if (this.message.length != 0) {
                this.conversions.message.push(this.message);
                axios.post('/conversations', {
                    message : this.message,
                    conversations:this.conversations
                })
                .then(response => {
                    console.log(response);
                    this.message = ''
                })
                .catch(error => {
                    console.log(error);
                });
            }
        }

Activity icon

Replied to Problem With V-model On Message Input & IsTyping Indicator

@theunforgiven I don't know the whole structure of your code.But I think your conversations should object in my mind.Something like this

 data() {
     return {
        conversations: {
        message: []
        },  
                message: '',
            }
        },
Activity icon

Replied to Conditionally Show Blade View

Another option base on your problem.

@if (\Request::is('*/fields') OR \Request::is('*/fields/*') )
    
@else
  
@endif

Jun
11
4 months ago
Activity icon

Replied to Return Json Response For Only API 404 Error

@elo

get localhost:8000/books/1 return default laravle 404 not found page

get localhost:8000/api/books/1 return json response

Now I realize your problem. That error should be in web.php.You don't have fallback function for web.php.You can create custom 404 view.

//handler.php
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

 public function render($request, Exception $exception)
    {
        if ($exception instanceof NotFoundHttpException) {
            return Route::respondWithRoute('fallback');
        }

        if ($exception instanceof ModelNotFoundException) {
            return Route::respondWithRoute('fallback');
        }

        return parent::render($request, $exception);
    }

//api.php
Route::fallback(function () {
    return response()->json(['error' => 'Not Found!'], 404);
});

//web.php
Route::fallback(function () {
    return view('errors.404'); //custom view
});

If you want to laravel default 404 page, you can clear logic inhandler.php

//api.php
Route::fallback(function () {
    return response()->json(['error' => 'Not Found!'], 404);
});

//web.php
Route::fallback(function () {
    return abort(404); //default 404
});

Activity icon

Replied to Return Json Response For Only API 404 Error

@elo This error means Handler.php not found fallback function.Try debug in api.php

Route::fallback(function () {
   dd(here);
});
Jun
10
4 months ago
Activity icon

Replied to Return Json Response For Only API 404 Error

@elo Try this

//handler.php
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

 public function render($request, Exception $exception)
    {
        if ($exception instanceof NotFoundHttpException) {
            return Route::respondWithRoute('fallback');
        }

        if ($exception instanceof ModelNotFoundException) {
            return Route::respondWithRoute('fallback');
        }

        return parent::render($request, $exception);
    }

//api.php
Route::fallback(function () {
    return response()->json(['error' => 'Not Found!'], 404);
});

Jun
01
4 months ago
Activity icon

Replied to Passport With Cookies And CSRF Protection.

@jlwalker

I realise now that you really can’t.

What that means?I give you just an advice.

localStorage uses essentially the same security policy as cookies; one of its core principles is that a domain cannot access localStorage data that was created under a different domain so there is no chance that a website could steal data from a different website. I don't want to dispute with you.If you want cookies prevent from csrf, use SameSite=strict cookie.

May
31
4 months ago
Activity icon

Replied to Passport With Cookies And CSRF Protection.

Cookies vs local storage

Both of the mechanisms have their own pros and cons.It doesn't matter what you use.You should concentrate on XSS protection, that’s perfect of the protection. Everything is safe against a remote attacker as long as you use HTTPS and there is no XSS on your page. Your main concern should be avoiding XSS. If you have XSS on your page then basically everything is lost, the attacker will be able to attack the user’s session one way or other, it does not matter if you use cookies, local / session storage or IndexedDB, etc.

May
29
4 months ago
Activity icon

Replied to Logic Architecuture For Passport Token Expire Time

Solved!Actually, my code flow is wrong.

 $tokenResult = $user->createToken('Personal Access Token');
  if ($request->remember_me) {
         Passport::personalAccessTokensExpireIn(now()->addHours(3));
       } else {
         Passport::personalAccessTokensExpireIn(now()->addMinutes(15));
       } //I tried to add time after create token and that make didn't work.
----------------------------------------------------------------------------------------------------
   if ($request->remember_me) {
            Passport::personalAccessTokensExpireIn(now()->addHours(3));
        } else {
            Passport::personalAccessTokensExpireIn(now()->addMinutes(15));
        }
        $tokenResult = $user->createToken('Personal Access Token');         
May
28
4 months ago
Activity icon

Replied to Update With CRUD

Route::resource('shares', 'ShareController');

That is already created 7 routes.Read to Laravel documentation.Check with

php artisan route:list

By the way

Route::get('update', '[email protected]');

Update method shouldn't use with get and will get error.

Activity icon

Started a new conversation Logic Architecuture For Passport Token Expire Time

I don't know that much about passport.I need advice for passport token expire time.I searched for it but I still haven't found any appropiate answer. When user click remember_me token lifetime should be long-lived. So,

//AuthServiceProvider.php

 if ($request->remember_me) {
            Passport::personalAccessTokensExpireIn(Carbon::now()->addHours(1));
        } else {
            Passport::personalAccessTokensExpireIn(Carbon::now()->addMinutes(1));
        }

It works but I think that isn't not appropiate solution.I didn't want to set this logic in AuthServiceProvider.php.I want to handle in controller.

//Controller 
if ($request->remember_me) {
        Passport::personalAccessTokensExpireIn(Carbon::now()->addHours(1));//it doesn't work

            $token->expires_at = Carbon::now()->addHours(1);//only work in database value ,it doesn't affect for passport
        }

//AuthServiceProvider
    Passport::personalAccessTokensExpireIn(Carbon::now()->addMinutes(1)); //I want to put this default.

Any your advice will be greatly appreciated.

May
23
4 months ago
Activity icon

Replied to Laravel Eloquent Filter Product's Attributes

@kakallatt Try this one!

$products = Product::whereHas('attributes', function ($query) {
        $query->where('name', 'RAM')
            ->whereIn('value', ['8GB', '4GB']);
    })->whereHas('attributes', function ($query) {
        $query->where('name', 'HDD')
            ->where('value', '256GB');
    })->get();
Activity icon

Replied to Which Editor Do You Use To Work?

VS Code is not an IDE like Visual Studio and Phpstrom. It is also not a simple code editor with a few commands and syntax highlighting. It sits somewhere in the middle, making it a simple yet powerful tool thanks to the fact that it supports extensions.

  • It’s free and cross-platform (Linux and Apple are also supported).
  • It’s way smaller than Eclipse, NetBeans, and other big IDEs.
  • It’s more advanced than Notepad++ and other simple code editors.
  • It’s well supported by Microsoft and the developer community.
  • It's support typescript intellisense and Git tools work well.
  • There are many extensions available for different languages and file formats.
  • The range of available plugins is growing more quickly than the Jetbrains tools

PhpStorm is an IDE by JetBrains that provides a wide range of cutting-edge features. It is a project-based IDE designed for experienced coders looking to develop professional platforms and large applications.

  • The application is built on Java which is a huge advantage to developers. It lets developers use the software on multiple development platforms and carry a conducive development environment with them.
  • It's powerful but not free.
  • You may pay for it, but you get better access to support and Jetbrains as a company tries to be very good at serving customer requests
  • Better code refactorings and more intelligent understanding of code analysis

I will go to VS code but this is just my view.

May
22
4 months ago
Activity icon

Replied to How To Get All The Namespace Group Route

You mean?

php artisan route:list
Activity icon

Replied to Dynamic Table

@wultyc Why not work bro?Think as simple.Try this one.

//in controller
    use Illuminate\Support\Facades\Schema;

public function index()
    {
     
    $data = DB::table('table_name')->get();
        $columns = Schema::getColumnListing('table_name');

        return view('yourview.index', compact('columns','data'));
    }
//view
         <table>
            <tr>
                @foreach ($columns as $column)
                <th>{{$column}}</th>
                
                @endforeach
            </tr>
            @foreach ($data as $value)
            <tr>
                    @foreach ($columns as $column)
                        
                    <td>{{$value->$column}}</td>
                    @endforeach
                 
                </tr>
                @endforeach
               
              </table>

That is exactly what you want?

Activity icon

Replied to Dynamic Table

@wultyc

//controller
use Illuminate\Support\Facades\Schema;

public function index()
    {
     
        $columns = Schema::getColumnListing('table_name');

        return view('yourview.index', compact('columns'));
    }

//view
<table>
    <tr>
            <?php $number = 1; ?>
            @foreach($columns as $column)
    
            <th>{{ $number }} </th>
            <?php $number++; ?>
        @endforeach
    </tr>
    <tr>
            @foreach ($columns as $column)
            <td>{{ $column}}</td>
        @endforeach
    </tr>
</table>
Activity icon

Replied to Laravel 5.8 Foreign Key Not Working

Not sure.But try this

 $table->unsignedBigInteger('a_id')->index();
Activity icon

Replied to Multiselect Vue Data Properties And Methods Missing

import Multi from './multi.vue'; 

Vue.component('multi', Multi); 

var app = new Vue({
    mixins: [require('spark')],
});
May
21
4 months ago
Activity icon

Replied to VSC Blade Snippets Not Recognizing Blade.php

@dan3460 Find your settings.json file in vscode and add this code

"blade.format.enable": true,
 "emmet.includeLanguages": {
        "blade": "html"
  },
    
Activity icon

Replied to Multiselect Vue Data Properties And Methods Missing

@demoskp You are using vue package but try to solve with .js file? In multiselect.vue

<template>
        <multiselect v-model="value" tag-placeholder="Add this as new tag" placeholder="Search or add a tag" label="name" track-by="code" :options="options" :multiple="true" :taggable="true" @tag="addTag"></multiselect>
</template>
<script>

import Multiselect from 'vue-multiselect'
  
export default {
    components: {
      Multiselect
    },
    data () {
      return {
        value: [
          { name: 'Javascript', code: 'js' }
        ],
        options: [
          { name: 'Vue.js', code: 'vu' },
          { name: 'Javascript', code: 'js' },
          { name: 'Open Source', code: 'os' }
        ]
      }
    },
    methods: {
      addTag (newTag) {
        const tag = {
          name: newTag,
          code: newTag.substring(0, 2) + Math.floor((Math.random() * 10000000))
        }
        this.options.push(tag)
        this.value.push(tag)
      }
    },
    
  }

</script>

In app.js

Vue.component('multi', require('./multi.vue').default); 
//shouldn't same name with multiselect.It will be overwritten package's component and will be error Maximum call stack size exceeded

var app = new Vue({
    el: '#app',        //BTW you forgot in vue instance
    mixins: [require('spark')],
});

You can call in blade

<div id="app">
<multi></multi>
</div>
Activity icon

Replied to Redirection Failure On Captcha

Model needs to implement theIlluminate\Contracts\Auth\Authenticatableinterface

use Illuminate\Contracts\Auth\Authenticatable

class YourClass extends Model implements Authenticatable
{
    
}