YeZawHein

YeZawHein

Member Since 1 Year Ago

Experience Points 53,800
Experience Level 11

1,200 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 470
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.

11 Sep
1 week ago

YeZawHein left a reply on 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)
09 Sep
1 week ago

YeZawHein left a reply on More Cleaner Way

Why don't use conditional statement in blade?

02 Sep
2 weeks ago

YeZawHein left a reply on 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.

YeZawHein left a reply on 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')}}
31 Aug
2 weeks ago

YeZawHein left a reply on How To Update All Option ?

@van1310 what relationship do you have between these tables?

30 Aug
2 weeks ago
16 Aug
1 month ago

YeZawHein left a reply on 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.

YeZawHein left a reply on 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>
13 Aug
1 month ago

YeZawHein left a reply on 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');
      }
09 Aug
1 month ago

YeZawHein left a reply on 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;
                })
            },
}
03 Aug
1 month ago

YeZawHein left a reply on ArgumentCountError In Laravel 5.8

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

25 Jul
1 month ago

YeZawHein left a reply on Alternative To Paginate On Collection?

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

YeZawHein left a reply on Passport Token Is Still Valid After Revocation (even Deletion)?

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

22 Jul
1 month ago

YeZawHein left a reply on SQL Cannot Add Forign Key

Try with bigInteger.

18 Jul
2 months ago

YeZawHein left a reply on Composer Requirements Conflict

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

09 Jul
2 months ago

YeZawHein left a reply on 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.

05 Jul
2 months ago

YeZawHein left a reply on Can't Connect To Algolia .

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

YeZawHein left a reply on Dynamic Arguments Not Working.

v-bind:href="url"
13 Jun
3 months ago

YeZawHein left a reply on 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 :)

YeZawHein left a reply on 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>

YeZawHein left a reply on 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);
                });
            }
        }

YeZawHein left a reply on 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: '',
            }
        },

YeZawHein left a reply on Conditionally Show Blade View

Another option base on your problem.

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

11 Jun
3 months ago

YeZawHein left a reply on 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
});

YeZawHein left a reply on 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);
});
10 Jun
3 months ago

YeZawHein left a reply on 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);
});

01 Jun
3 months ago

YeZawHein left a reply on 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.

31 May
3 months ago

YeZawHein left a reply on 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.

29 May
3 months ago

YeZawHein left a reply on 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');         
28 May
3 months ago

YeZawHein left a reply on 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.

YeZawHein 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.

23 May
3 months ago

YeZawHein left a reply on 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();

YeZawHein left a reply on 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.

22 May
3 months ago

YeZawHein left a reply on How To Get All The Namespace Group Route

You mean?

php artisan route:list

YeZawHein left a reply on 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?

YeZawHein left a reply on 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>

YeZawHein left a reply on Laravel 5.8 Foreign Key Not Working

Not sure.But try this

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

YeZawHein left a reply on Multiselect Vue Data Properties And Methods Missing

import Multi from './multi.vue'; 

Vue.component('multi', Multi); 

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

YeZawHein left a reply on 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"
  },
    

YeZawHein left a reply on 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>

YeZawHein left a reply on Redirection Failure On Captcha

Model needs to implement theIlluminate\Contracts\Auth\Authenticatableinterface

use Illuminate\Contracts\Auth\Authenticatable

class YourClass extends Model implements Authenticatable
{
    
}

YeZawHein left a reply on Page Not Found - Except Route Proplem

Route::post('product/test', '[email protected]');
16 May
4 months ago

YeZawHein left a reply on How To Update A Product In Laravel 5,8

He said when you update, you should know what id in product want to update.

public function update($id , Request $request)
{
   $product = Product::findOrFail($id);
//your codes
}
15 May
4 months ago

YeZawHein left a reply on Data Not Saving In Database Table In Real

@devfrey That is just business requirement.Everything is possible.

YeZawHein left a reply on Data Not Saving In Database Table In Real

Using fillable is good but when if you have more than 15-30 fields in your model? I seen your suggested answer and solved at above.That is just an another option.

YeZawHein left a reply on Data Not Saving In Database Table In Real

@engrlaravel If you want to make all attributes assignable, you may define the $guarded property as an empty array.

 protected $table = 'your_table_name';

  protected $guarded = [ ];

YeZawHein left a reply on User Data Isn't Showing Form Db And Not Giving Any Error

@programmer111 You should be use created() method.created is more compatible than methods to fetch data from server.

 created(){
     axios.get('/api/user')
          .then(response => this.users = response.data);
   }
-----------------------------------------------------------------------------
//Same way for ES15
created(){
     axios.get('/api/user')
          .then( ({data}) => this.users = data);
   }