Ain

Ain

Member Since 6 Months Ago

Experience Points
2,430
Total
Experience

2,570 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
0
Lessons
Completed
Best Reply Awards
0
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 1
2,430 XP
23 Sep
13 hours ago

Ain left a reply on Displaying Only The Data That That Particular User Input

@nakov

i put below coding in my SaleController. But still error. Did i do it wrong?

use Illuminate\Contracts\View\View;

Btw, how do i set up the relationship in user model like you mention below?

public function compose( View $view )
{
    if (auth()->user()->role === 'Staff') // make your actual check here, if you have a Gate even better.
    {
        $sales = Sales::all();
    }
    else
    {
        // for this in your User model you will have to have the relationship setup
        // this will get only the current user's sales.
        $sales = auth()->user()->sales();
    }

    $view->with('sales', $sales);
}
22 Sep
1 day ago

Ain left a reply on Displaying Only The Data That That Particular User Input

@nakov

im trying to use your code, but there is an error appear. Mind helping?

https://imgur.com/a/UcjLBDq

17 Sep
6 days ago

Ain started a new conversation Displaying Only The Data That That Particular User Input

I have a table name 'sales'. All the sales data been stored there. There are also 3 users for my system; Staff, Master Stockist and Stockist.

Im trying to display the data, for example a stockist enter. Only the data that she/he entered, not the whole data in db.

There are numerous master stockist, stockist and staff.

What should I do?

P/s staff can view the whole data in db.

16 Sep
1 week ago

Ain started a new conversation How To Correctly Name A Folder

If i want to name my folder "individual sales", how do i write it? does it have any specific way?

13 Sep
1 week ago

Ain left a reply on Required Data

i see, thank you for the info, its working fine now. thank you again!

Ain left a reply on Required Data

oh im sorry, i forgot to explain. i fill out all the field except for role and i click on submit button. After that it display this error.

https://imgur.com/a/h8wRJEH

Ain left a reply on Required Data

oh really? because i am expecting a pop up like below picture to occur

https://imgur.com/a/TCuMkhJ

Ain left a reply on Required Data

I already try this before but it return error saying that role_id cannot be null.

Ain started a new conversation Required Data

How can I put the below coding into the ROLE part?

 'required' => 'required'

This is the other part which is email that I already done. But since it is not dropdown, so I can easily put it after the place holder.

<div class="form-group">
     {!! Form::label('email', 'Email:') !!}
     {!! Form::text('email', null, ['class' => 'form-control', 'placeholder' => 'Email', 'required' => 'required']) !!}
</div>

This is the coding for Role part.

{{--ROLE--}}
                    {!! Form::label('role_id', 'Role:') !!}
                    <div class="form-group">
                        <select class="form-control" name="role_id">
                            <option disabled selected>--- Select Role ---</option>
                            @foreach($roles as $r)
                                <option value="{{$r->id}}">{{$r->name}}</option>
                            @endforeach
                        </select>
                    </div>

Ain left a reply on Pop Up Message For Incomplete Data Entry

may i know where should i put this coding?

12 Sep
1 week ago

Ain left a reply on Pop Up Message For Incomplete Data Entry

Im not sure but currently i am using this code to add pop up message

 @if(Session::has('add_report_success'))
        <body onload="add_report_success()">
@endif

        @endsection

        @section('script')
            <script type="text/javascript">

                //        Notification
                function add_report_success(){
                    alert ('Successfully submit!')
                }
            </script>
        @endsection

Ain left a reply on Pop Up Message For Incomplete Data Entry

no, a message if user forgot to enter the data

10 Sep
1 week ago

Ain started a new conversation Pop Up Message For Incomplete Data Entry

May I know how can I do a pop up message for incompletion of data? Im using a simple form.

06 Sep
2 weeks ago

Ain started a new conversation Error 404 Not Found

Im trying to reach the edit page of sales, but it display 404 not found. But the rest of the routes are working so well, except for this one.

route

Route::resource('/sales', 'SaleController');

index.blade.php

{{--Display name--}}
<td><a href="{{route('sales.edit', $sale)}}">{{$sale->name}}</a></td>

controller

public function edit(Sale $sales)
   {
       $id = $sales->id;

       $sales = Sale::findOrFail($id);

       return view ('sales.edit', compact ('sales'));
   }

this is the position of the blade https://imgur.com/a/dy6y7xv

04 Sep
2 weeks ago

Ain started a new conversation Store Data From Dropdown

How do I store the data that is selected (from create.blade.php) into database?

This is under users table

{{--ROLE--}}
                    <div class="form-group">
                        <label for="role_id">Role</label>

                        <select class="form-control" name="role_id">
                            <option disabled selected>--- Select role ---</option>
                            <option value="1">Staff</option>
                            <option value="2">Master Stockist</option>
                            <option value="2">Stockist</option>
                            <option value="2">Agent</option>
                            <option value="2">Dropship</option>
                            <option value="2">Supplier</option>
                        </select>

                        @if ($errors->has('role_id'))
                            <span class="help-block">
                                        <strong>{{ $errors->first('role_id') }}</strong>
                                    </span>
                        @endif
                    </div>
03 Sep
2 weeks ago

Ain left a reply on Explain Simple Coding (store)

thank youu nakov

Ain started a new conversation Explain Simple Coding (store)

I did not understand the foreach part. Can some explain it to me?

        $group = Group::create(
            [
                'name' => $group_name,
                'product_id' => $product->id
            ]
        );


        foreach($group_members as $group_member){
            $group_member['group_id'] = $group->id;
            GroupMember::create($group_member);
        }
28 Aug
3 weeks ago

Ain started a new conversation How To Remove Or Uninstall Yajra Datatable?

do you guys know how?

Ain left a reply on Datatable Not Working

do you know how can i uninstall yajra datatable?

Ain started a new conversation Datatable Not Working

index.blade.php - i put it below the other coding

@section('script')
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="//cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"  ></script>
    <script type="text/javascript">
        $(document).ready( function () {
            $('#laravel_datatable').DataTable();
        } );
    </script>
@endsection

app.blade.php

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>{{ config('app.name', 'Laravel') }}</title>

    <!-- Scripts -->
    <script src="{{ asset('js/app.js') }}" defer></script>

    <!-- Fonts -->
    <link rel="dns-prefetch" href="//fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">

    <!-- Styles -->
    <link href="{{ asset('css/app.css') }}" rel="stylesheet">

</head>

and i pun @yield('script') at the bottom (app.blade.php)

Ain left a reply on Data Not Display

its working, thank you nakov :)

Ain left a reply on Data Not Display

already upload it

Ain started a new conversation Data Not Display

Im trying to get the data from other table, but its not coming out

index.blade.php

{{--Display role--}}
@if($user->userRole)
        <td>{{$user->userRole->name}}</td>
@endif

model

public function userRole()
    {
        return $this->belongsTo('App\UserRole');
    }

27 Aug
3 weeks ago

Ain left a reply on Database Seed

Thank you for the suggestion trayyy

Ain left a reply on Database Seed

its okay, I already found the error guys.

Ain started a new conversation Database Seed

I have problem during deal with db seed and I dont know what to do

https://imgur.com/a/jxCO02O

DB::table('stock')->insert([

            [
                'vendor'=>'Sidratul Corporation Sdn Bhd',
                'ship_to'=>'Lespettua Sdn  Bhd'],
                'description'=>'Lespettua Kemiri Shampoo (250ML)',
                'quantity'=>'1000',
                'unit_price'=>'RM9.60',
                'total'=>'RM14,400.00',
                'comment'=>'Thank you for your business.',
                'date'=>'2019/05/13'
            ],

            [
                'vendor'=>'Sidratul Corporation Sdn Bhd',
                'ship_to'=>'Lespettua Sdn  Bhd',
                'description'=>'Lespettua Kemiri Balm (50G)',
                'quantity'=>'1000',
                'unit_price'=>'RM 7.50',
                'total'=>'RM 7,500.00',
                'comment'=>'Thank you for your business.',
                'date'=>'2019/01/22'
            ],

            [
                'vendor'=>'Sidratul Corporation Sdn Bhd',
                'ship_to'=>'Lespettua Sdn Bhd',
                'description'=>'Lespettua Kemiri Shampoo (250ML)',
                'quantity'=>'1000',
                'unit_price'=>'RM 9.60',
                'total'=>'RM 14,400.00',
                'comment'=>'Thank you for your business.',
                'date'=>'2019/06/11'
            ],

        ]);

Ain left a reply on Date

I use DD/MM/YYYY.

Btw thank you Resin, I will try it later.

Ain started a new conversation Date

May I know what is the default date format in laravel 5.8?

Because im trying to insert data from db seed, but it says that my date format is wrong

Ain left a reply on Laravel Collective

if I use the command, will problem occur?

Ain left a reply on Laravel Collective

May I know, what I have to do if I already download it? Because before this i use command like this

composer require "laravelcollective/html":"^5.6.0"

Ain left a reply on Relationship

I already post another question regarding laravel collective. If you have time, can you help me with that?

Ain started a new conversation Laravel Collective

Im doing another project by using laravel 5.8 now. But since there is no more laravel collective, what should I do? I need to use it.

Ain left a reply on Relationship

thank you for your time bobby :)

26 Aug
4 weeks ago

Ain started a new conversation Relationship

I have one to many relationship. If my belongsTo table doesnt have FK, can I still use the belongsTo?

15 May
4 months ago

Ain left a reply on Bootswatch

@SNAPEY - i know right? ok thanks snapey

Ain started a new conversation Bootswatch

This is some random question,

but does Bootswatch consider as a software?

23 Apr
5 months ago

Ain left a reply on My Add Group Member Button Not Fuctioning (javascript)

@FTIERSCH - How to include jquery, and where?

Ain left a reply on My Add Group Member Button Not Fuctioning (javascript)

@MVD - i am very sorry mvd, my javascript knowledge is not that good. Can you show me how?

Ain left a reply on My Add Group Member Button Not Fuctioning (javascript)

@FTIERSCH - This is my app.blade.php

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<html lang="{{ app()->getLocale() }}">
<head>
   <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
   <link  href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css" rel="stylesheet">
   <link rel="stylesheet" href="css/app.css">

  
   {{--Bootswatch:2--}}
   <!-- Latest compiled and minified CSS -->
   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
   
<!-- Optional theme -->
   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
   
<!-- Latest compiled and minified JavaScript -->
   <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>

   <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.2.0/css/pulse/bootstrap.min.css">
  


   <!-- CSRF Token -->
   <meta name="csrf-token" content="{{ csrf_token() }}">

   <title>{{ config('dev.name','ICJS') }}</title>

   <!-- Scripts -->
   <script src="{{ asset('js/app.js') }}" defer></script>


</head>


<body>
<div id="app">

   @include('include.navbar')

   <main class="py-4">
       @yield('content')
   </main>
</div>
</body>
</html>


@yield('script')


Ain started a new conversation My Add Group Member Button Not Fuctioning (javascript)

"Add Group Member" button supposedly will display new row for user to enter data like this. https://imgur.com/a/pLJsoy8

But in this case, there is no new row display when i clicked on it.

this is my blade : create.blade.php

@extends('layouts.app')

@section('content')

   <div class="container">
   <div class="row">
   <div class="col-md-11 col-md-offset-2">

   <div class="col-sm-9">
       <h1>Add Group</h1>

       {!! Form::open(['method' => 'POST', 'action' => ['[email protected]']]) !!}


       {!! Form::label('name', 'Name:') !!}
       {!! Form::text('name', null, ['class' => 'form-control', 'placeholder' => 'Group Name']) !!}

       {!! Form::label('product_name', 'Product Name:') !!}
       {!! Form::text('product_name', null, ['class' => 'form-control', 'placeholder' => 'Product Name']) !!}

       {!! Form::label('product_type', 'Product Type:') !!}
       {!! Form::text('product_type', null, ['class' => 'form-control', 'placeholder' => 'Product Type']) !!}

       {{--{!! Form::label('product_type', 'Product Type:') !!}--}}
       {{--{!! Form::select('product_type', ['' => '--- Choose Product Type ---'] + $pluck_products, null, ['class' => 'form-control', 'required']) !!}--}}


       <h3>Group Member</h3>

           <div class="container-fluid">
               {{--store data form in array for multiple group members--}}

               <table class="table table-bordered" id="dynamic_field">
                       <tr>
                           <td>
                               {!! Form::text('group_member[0][name]', null , ['class' => 'form-control', 'placeholder' => 'Name']) !!}
                           </td>
                           <td>
                               {!! Form::text('group_member[0][affiliation]', null, ['class' => 'form-control', 'placeholder' => 'Affiliation']) !!}
                           </td>
                           <td>
                               <button title='Add Member' type="button" id="add" class="btn btn-primary">Add Group Member</button>
                           </td>
                       </tr>
               </table>
           </div>

       <br/>
       {!! Form::submit('Create Group', ['class'=>'btn btn-primary btn-lg col-sm-12']) !!}
       {!! Form::close() !!}
   </div>

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

@endsection

@section('script')
   <script type="text/javascript">
       // ------ Adding new row of input fields to create new group members
       var i=1;
       var j=1;

       $('#add').click(function(){

           // The limit of the author can be added.
           if(i < 5){

               i++; // adding the authors count to one if add button is clicked

               $('#dynamic_field')
                   .append('' +
                       '<tr id="row'+i+'" class="dynamic-added">' +
                       '<input name="group_member['+j+'][id]" type="hidden" class="form-control" id="id">' +
                       '<td>' +
                       '<input name="group_member['+j+'][name]" type="text" class="form-control " placeholder="Name" id="name" required>' +
                       '</td>' +
                       '<td>' +
                       '<input name="group_member['+j+'][affiliation]" type="text" class="form-control " placeholder="Affiliation" id="affiliation" required>' +
                       '</td>' +
                       '<td>' +
                       '<button title="Remove Field" type="button" name="remove" id="'+i+'" class="btn btn-danger btn_remove ">Remove Group Member</button>' +
                       '</td>' +
                       '</tr>'
                   );

               j++; // Author array[]
           }
           else {
               alert('Limit of group members reached!');
           }

       });

       // ------ Action to remove the added fields
       $(document).on('click', '.btn_remove', function(){
           var button_id = $(this).attr("id");
           $('#row'+button_id+'').remove();

           i--; // Count author minus if one column removed
       });
   </script>
@endsection
22 Apr
5 months ago

Ain left a reply on Login Interface Take A Long Time To Display

@FTIERSCH - I access my project using local host and my internet speed is good

Ain started a new conversation Login Interface Take A Long Time To Display

Why does after I click on login at welcome page, it takes too long to response which is to display the login page. I would like to know the cause and how to deal with it.

Anybody know why and how?

16 Apr
5 months ago

Ain started a new conversation Bootstrap 3.3.7

I'm currently using bootstrap 3.3.7, but I couldn't find the documentation in order to modify the navbar color for example, or maybe the table design in my project.

Did you guys know how to customize our project using bootstrap 3.3.7?

14 Apr
5 months ago

Ain left a reply on Registration Redirect

@BOBBYBOUWMANN - its working! thank you bobby :)

Ain left a reply on Registration Redirect

@BOBBYBOUWMANN - Is it possible to direct it back to the register.blade instead of index for admin?

Ain left a reply on Registration Redirect

@BOBBYBOUWMANN - I already try to change it, but it still login into that new register user account.

Ain left a reply on Count (involving Pivot Table)

@BOBBYBOUWMANN - is this use to count the admin? because if yes, I already done that part. And only judge has assigned booth.