msyaukat

msyaukat

Lecturer at IIUM

Kuantan

Member Since 1 Year Ago

Experience Points 3,910
Experience
Level
Lessons Completed 22
Lessons
Completed
Best Reply Awards 0
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

30 Jul
4 months ago

msyaukat started a new conversation How Do I Store A Unique ID?

How do I store a unique ID for a slug?

In the lesson I learn, I use this method to store:

public function store(Request $request)
    {
        $user = Auth::user();

        $company = new Company;

        $company->company_name = $request->input('company_name');
        $company->company_description = $request->input('company_description');
        $company->user_id = Auth()->user()->id;

in this new lesson, the teacher uses:

$company->company()->create([
    'slug' => uniqid(true)'

how do I incorporate this new one in my old (the one that I'm using)?

10 Apr
8 months ago

msyaukat left a reply on Need Elaboration On Polymorphic Relationship

thanks a lot @topvillas . I pray for your success.

msyaukat started a new conversation Need Elaboration On Polymorphic Relationship

  1. In the documentation on Polymorphic Relation:
comments
    id - integer
    body - text
    commentable_id - integer
    commentable_type - string

what is the commentable_type? is it where you state whether it's for this instance video or post? if so, why do you need to state that as you already has commentable_id which refers to video or post.

  1. Can we have Polymorphic Relation for more than 2 comments. For example, comments for video, post, and picture.

thanks

msyaukat left a reply on Laravel-Vue Comment System

@rin4ik I am using this tutorial. I would like to know how to use vue on it. Can I use the lesson on this tutorial and add in vue? or if I want to use vue I need some other way?

06 Apr
8 months ago

msyaukat started a new conversation Laravel-Vue Comment System

I wanted to create a dynamic comment system in my Laravel project. Since I'm still learning Vue, will it be a good idea for me to create a non-dynamic comment system first then add in Vue components to it?

If you know any good tutorial on this, please guide me to it.

thanks

05 Mar
9 months ago

msyaukat left a reply on Converting To Php 7.

hmmm ... these are the stuff that I know:

laravel version 5.4.28

I'm using a local server mySQL

.....

I've searched for how to update php. why does it looks complicated?

@vmitchell85 @SaquibRizwan @Cronix

msyaukat started a new conversation Converting To Php 7.

I wanted to install a package that handles comment using vue on my Laravel project. Upon installing, it wants me to update to php 7.1.

faustbrian/laravel-commentable 2.1.4 requires php ^7.1 -> your PHP version (5.6.28) does not satisfy that requirement.

should I continue? will there be any conflicts?

14 Feb
10 months ago

msyaukat left a reply on Can't Create A New Vue Component Using Laravel Mix.

omg. this always happens to me. it's all because of a . thanks @Bakanyaka .

Do I need to npm run dev every time I add a new component?

msyaukat started a new conversation Can't Create A New Vue Component Using Laravel Mix.

I can't create a new Vue component using Laravel mix.

Here's my component on app.js:

// this one is okay
Vue.component('test', require('./components/Test.vue')); 

// this one is cannot be done
Vue.component('company-comment', require('/components/company-comment.vue'));

this is the error:

This dependency was not found:

* /components/company-comment.vue in ./resources/assets/js/app.js

To install it, you can run: npm install --save /components/company-comment.vue

after I follow the instruction this appear:

npm ERR! Could not install from "..\..\..\components\company-comment.vue" as it does not contain a package.json file.

what seems to be the problem?

13 Feb
10 months ago

msyaukat left a reply on Why Is My Vue In Laravel Not Showing?

got it. thanks @tykus ... I would have never known how to deal with this myself. How am I supposed to know that the error can be solved by clearing the cache. I also did as the prompt asked me to: npm rebuild node-sass --force . Whatever this mean.

thanks again. may God bless your life.

msyaukat left a reply on Why Is My Vue In Laravel Not Showing?

hi @tykus ,

how do I execute the rm ? it's not recognized.

12 Feb
10 months ago

msyaukat left a reply on Why Is My Vue In Laravel Not Showing?

I do have the testcomponent registered.

Vue.component('test', require('./components/Test.vue'));

I think there's a big error:

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ dev: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Muhammad Syaukat\AppData\Roaming\npm-cache\_logs18-02-12T19_18_49_577Z-debug.log

this happened after npm run dev

msyaukat left a reply on Why Is My Vue In Laravel Not Showing?

this is my test page where I wanted test to load it. The one on top is my project page.

@tykus this is my first attempt in implementing vue in Laravel. I don't know what Laravel Mix is.

msyaukat left a reply on Why Is My Vue In Laravel Not Showing?

codes.

test componet (Test.vue):

<template>
    <div class="container">
        <div class="row">
            <div class="col-md-8 col-md-offset-2">
                <div class="panel panel-default">
                    <div class="panel-heading">Example Component</div>

                    <div class="panel-body">
                        I'm an example component!
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        mounted() {
            console.log('component mounted')
        }
        
    }
</script>

view:

<!DOCTYPE html>
<html>
<body>
<link rel="stylesheet" type="text/css" href="css/app.css">
<h1>My First Heading</h1>
  <div id="app">
    <test></test>
  </div>
<p>My first paragraph.</p>
<script src="/js/app.js" charset="utf-8"></script>
</body>
</html>

@topvillas @Drfraker

msyaukat left a reply on Why Is My Vue In Laravel Not Showing?

@tykus the test component is actually the ```example`` component which I have renamed. As a matter of fact, I can't load this yet.

I'm using a CDN.

I have other script loaded for the page: AJAX for googlemaps. is this disturbing vue?

msyaukat started a new conversation Why Is My Vue In Laravel Not Showing?

why is my vue not showing? did I wrap it wrongly? view:

<div class="container">
  <div class="row">
    <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-default">
        <div class="panel panel-default" id="app">
                 <div class="panel-heading">Comments with Vue</div>
                 
                 <test>Here is the vue</test>

             </div>
  </div>
  </div>  
</div>

this works in an empty blank HTML.

07 Feb
10 months ago

msyaukat started a new conversation Will Laravel Blade Conflict With Vue.js?

I've learnt a fair bit of Laravel and now learning vue.js to do some cool stuff in my Laravel project. I noticed that both uses {{ }} (I don't know what these are called.

Question: will Laravel and Vue.js conflict for using the same expression?

05 Feb
10 months ago

msyaukat left a reply on Noob Help

@CodeJhonny apparently yes. it's because of caching. after some research all I need to do is ctrl + f5+ . I never had this problem when I studied Laravel. thanks dude.

04 Feb
10 months ago

msyaukat left a reply on Noob Help

@wilk_randall and @CodeJhonny , it seems that after I reboot my PC, everything is alright. Any idea what's that about? I hvn't reboot it for almost a month. thanks guys

03 Feb
10 months ago

msyaukat started a new conversation Noob Help

I'm just starting to learn Vue and I'm stuck. Not familiar with the error yet.

index:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>VueJS Tutorials</title>
        <link href="styles.css" rel="stylesheet" />
        <script src="https://unpkg.com/vue"></script>
    </head>
    <body>
        <div id="vue-app">
            <h1>Keyboard Events</h1>

            <label>Name:</label>
            <input type="text" v-model="name" />
            <span>{{ name }}</span>
             
            <label>Age:</label>
            <input type="text" v-model="age" />
            <span>{{ age }}</span>
        </div>
    </body>

    <script src="app.js"></script>
</html>

app.js:

new Vue({
    el: '#vue-app',
    data: {
        name: '',
        age: ''
    },
    methods: {
        logName: function(){
            console.log('you entered your name');
        },
        logAge: function(){
            console.log('you entered your age');
        }
    }
});

I know that this must be some stupid mistake. I copied the code exactly from the tutorial's github and it's not working. here's the error:

vue.js:584 [Vue warn]: Property or method "name" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.
13 Jan
11 months ago

msyaukat left a reply on Redirect With 2 Ids

done I just hv to call one model. tq

msyaukat left a reply on Redirect With 2 Ids

if I want to pass this:

return redirect()->route('companybranch.show', [
    'company_id' => $company->company_id, 
    'company_branch_id' => $companybranch->company_branch_id,
]);

that means I need to call:

$company = Company::find($company_id);

in my update controller right? when I did this, it says $company is undefined. How?

11 Jan
11 months ago

msyaukat left a reply on Redirect With 2 Ids

what does this mean?

Missing argument 3 for App\Http\Controllers\CompanyBranchController::update()

msyaukat left a reply on Edit & Update Route Problem

@tisuchi

why does it says :

Missing argument 3 for App\Http\Controllers\CompanyBranchController::update()

msyaukat started a new conversation Redirect With 2 Ids

how do I redirect after updating when my show has 2 ids: company_id and company_branch_id.

route:

Route::get('company/{company_id}/companybranch/{company_branch_id}', ['uses' => '[email protected]', 'as' => 'companybranch.show']);

controller of update:

public function update(Request $request, $company_branch_id)
    {
        $company = Company::find($company_id);
        $companybranch = CompanyBranch::find($company_branch_id);

//didn't include this

 return redirect()->route('companybranch.show', $company->company_id, $companybranch->company_branch_id);

msyaukat left a reply on Edit & Update Route Problem

okay updating is done. now how do I redirect after updating and grab company_id and company_branch_id?

controller:

return redirect()->route('companybranch.show', $company->company_id, $companybranch->company_branch_id);

route for show:

Route::get('company/{company_id}/companybranch/{company_branch_id}', ['uses' => '[email protected]', 'as' => 'companybranch.show']);
10 Jan
11 months ago

msyaukat started a new conversation Edit & Update Route Problem

I'm trying to execute an edit a COMPANY BRANCH which is related to a COMPANY. I'm stuck on how to update because I'm dealing with 2 keys for the route: company_id and company_branch_id.

Route:

Route::get('company/{company}/companybranch/{companybranch}/edit', ['uses' =>'[email protected]', 'as' => 'companybranch.edit']);

Route::post('company/{company}/companybranch/{companybranch}', ['uses' => '[email protected]', 'as' => 'companybranch.update']);

Form:

<form class="form-horizontal" role="form" method="POST" action="{{ route('companybranch.update', $company->company_id, $companybranch->company_branch_id) }}" enctype="multipart/form-data">
{{ csrf_field() }}

Controller:

public function edit($company_id, $companybranch_id)
    {
        $company = Company::find($company_id);
        $companybranch = CompanyBranch::find($companybranch_id);

public function update(Request $request, $company_id, $companybranch_id)
    {
        $company = Company::find($company_id);
        $companybranch = CompanyBranch::find($company_branch_id);
16 Nov
1 year ago

msyaukat left a reply on Is It Possible To Put @section In Conditional(IF)?

@tisuchi actually, this is not working.

09 Nov
1 year ago

msyaukat started a new conversation HasOne Query Existence.

how do I query hasOne existence? What I want to achieve is, if the user has not register their company's contact, Add Company Contact will appear.

this is my attempt:

controller

$companyContact = Company::find($id)->companycontact()->get();

view

@if($companyContact->isEmpty())
     <p><a href="#">Add Company Contact</a><p>
@endif
03 Nov
1 year ago

msyaukat started a new conversation Should I Use HasManyThrough Here?

This is my database:

User
-id

Company
-company_id
-user_id
-company_name

Company's Contact
-company_contact_id
-company_id
-company_address

Now, I want to query whether a user's company has added company contact. Having read the HasManyThrough relationship, it somehow says that I need to add a user_id key in the Company Contact table. Is that right?

because if that's right, later on if I want to add Company Branches, then it'll have multiple level of relationship.

01 Nov
1 year ago

msyaukat left a reply on Query: Authenticated User's Post's Comment.

@mdecooman I have yet to learn this. no wonder. thanks mate

msyaukat started a new conversation Query: Authenticated User's Post's Comment.

I know how to find the existence of Authenticated User's Post and Post's Comments using has. But, how do I find the existence of Authenticated User's Post's Comments?

$userComment  = Auth::user()->Post::has('comments')->get();

is this logical?

31 Oct
1 year ago

msyaukat left a reply on Relationship Conditionals (IF) For Post's Comments. How To?

$posts = App\Post::has('comments')->get();

is supposed to call for a collection right? Now, why if there's no comment for a post and I query:

@if($post->isEmpty())
   
@endif 

it still says that it has a comment? the column for the particular post is empty. So, isEmpty should be the query right?

msyaukat started a new conversation Is It Possible To Put @section In Conditional(IF)?

I'm using Google Map in my project. It requires a script which I include in a section: @section('script) . I want it to only load if one collection is empty:

@if($map->isEmpty())
    
@endif 

How do I wrap the section in the conditional?

msyaukat started a new conversation Relationship Conditionals (IF) For Post's Comments. How To?

How do I implement an "IF" statement for relationship? mine is not working:

@if($post->comments->isNotEmpty())
    <p><a href="#">Add Comments</a><p>
@endif 
25 Oct
1 year ago

msyaukat started a new conversation Problems With Phpunit(testing)

I am learning a lesson. I can't execute phpunit. Here's what it says:

     PHP Fatal error:  Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() in C:\xampp\htdocs\forum\vendor\phpunit\phpunit\src\TextUI\TestRunner.php on line 1066

Fatal error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() in C:\xampp\htdocs\forum\vendor\phpunit\phpunit\src\TextUI\TestRunner.php on line 1066
23 Oct
1 year ago

msyaukat left a reply on Authenticated User Checked, But Problem With Guest.

@tykus thanks a lot. I'll be more specific next time.

msyaukat started a new conversation Authenticated User Checked, But Problem With Guess.

I've checked the authenticated user, now if I'm a guess it says something is missing. Why does this happen? I've used "IF".

@if($company->user->id == Auth::user()->id)
     <p><a href"#">Edit Post</a></p>
@endif 

Why should there be a problem for guess?

19 Oct
1 year ago

msyaukat left a reply on If $post Is Authenticated User's Post?

@druc I've started with Laravel 5.2. This is new. Which lesson on Laracasts teaches this(Authorization)?

16 Oct
1 year ago

msyaukat left a reply on If $post Is Authenticated User's Post?

@PawelMysior now it won't work with guest(non-authenticated user). do I need to use auth::check?

msyaukat left a reply on If $post Is Authenticated User's Post?

@PawelMysior so I just need to change it to == ?

msyaukat started a new conversation If $post Is Authenticated User's Post?

How do I check if $post is Authenticated User's post? Which method should I use? There's no "isEqual".

@if({{$post->post_id}} = Auth::user()->posts->post_id)
                  Edit Post
                @endif
12 Oct
1 year ago

msyaukat left a reply on If Authenticated User Has Post?

thanks a lot guys. @tykus and @tisuchi . I am new in programming. Sorry if I annoy you guys with my unending question. Is it wrong to ask so many questions here?

msyaukat started a new conversation If Authenticated User Has Post?

I want to load if authenticated user has post load something, if authenticated user has not load something else. This is my attempt:

            @foreach($posts as $post)
                    
                    @if(collect([$post])->isEmpty());
                        <p>Add a post</p>
                    @else
                        {{ $post->post_title }}

                    @endforeach 

where did I do wrong?

11 Oct
1 year ago

msyaukat left a reply on How To Query Authenticated User's Post?

@Vable

so in the view, I just have to write:

@foreach($posts as $post)
{{ $post->post_title }}
@endforeach 

to retrieve the post's title

is this correct?

msyaukat left a reply on How To Query Authenticated User's Post?

@Vable

if I use

$user = User::find($id);

it will grab the user which id I inserted. I want to grab the user that is authenticated/currently logged in.

msyaukat started a new conversation How To Query Authenticated User's Post?

How do I retrieve authenticated user's post? I have done all the relationship.