tomasosho

tomasosho

Member Since 1 Year Ago

Experience Points
3,220
Total
Experience

1,780 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
1
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
3,220 XP
Feb
25
1 day ago
Activity icon

Replied to I Want To Display Message If Balance Is Lesser Than 50

@yiming

My DB Table

CREATE TABLE products (
    id         INTEGER  NOT NULL
                        PRIMARY KEY AUTOINCREMENT,
    product    VARCHAR  NOT NULL,
    warehouse_id    VARCHAR  NOT NULL,
    warehouse    VARCHAR  NOT NULL,
    balance    NUMERIC,
    created_at DATETIME,
    updated_at DATETIME,
    user_id    INTEGER
);
Activity icon

Replied to I Want To Display Message If Balance Is Lesser Than 50

They are all on the same table. table columns are:

product, warehouse_id, warehouse, and balance

@yiming

Activity icon

Started a new Conversation I Want To Display Message If Balance Is Lesser Than 50

I want to display a message containing the product name and warehouse name with balance from the products table stating that it is less than 50.

My controller p.s its very wrong!

 public function index(Warehouse $warehouses)
    {
        $warehouses = Warehouse::all();

        $products = Product::all();
        $balance = Product::all('balance');
        

        if ($product_n = $balance >= '50'){
          return view('home',compact('warehouses', 'products', 'balance'))->with('success','Great! Product created successfully.');
        }

        else{
          dd($product_n);
        }
Activity icon

Replied to How Do I Run My Application Without Starting A Server

start chrome http://127.0.0.1:8000/

cd file location

php artisan serve

save as .bat

for knowledge sakes

Activity icon

Started a new Conversation How Do I Run My Application Without Starting A Server

Is there a way to create an autorun icon to start my php artisan serve?

Activity icon

Awarded Best Reply on Named Route Doesn't Work

your web.php should be like

trans('saveobject').'/{id?}','[email protected]')->name('saveObject')->middleware('CheckOwner');
Activity icon

Replied to Named Route Doesn't Work

your web.php should be like

trans('saveobject').'/{id?}','[email protected]')->name('saveObject')->middleware('CheckOwner');
Activity icon

Replied to I Want A Select Drop Down For Products Under A Particular Warehouse To Display

My Route

Route::get('notes/{warehouse}/createout', '[email protected]');
Activity icon

Started a new Conversation I Want A Select Drop Down For Products Under A Particular Warehouse To Display

My controller

    public function createout(Warehouse $warehouse)
    {
        $warehouses = Warehouse::all();
        
        $warehouse = Warehouse::find($warehouse->id);
        
        $products = Product::select('warehouse_id')->get();
        //dd($products);
        return view('notes.createout',compact('products', 'warehouse', 'warehouses'));
    }

My views

<select name="product" class="form-control selectpicker" data-live-search="true">
                                            <option value=""></option>
                                            @foreach ($products as $product)
                                                <option value="{{$product->id}}">{{$product->product}}</option>
                                            @endforeach
                                        </select>
Feb
24
2 days ago
Activity icon

Replied to How Do I Get The Sum Of All Inputs And Outputs?

@sauravs012 it doesn't get the sum. it just keeps showing processing

Feb
23
3 days ago
Activity icon

Started a new Conversation How Do I Get The Sum Of All Inputs And Outputs?

My view

<script>
 $(document).ready( function () {
     $.ajaxSetup({
          headers: {
              'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
          }
      });
  $('#laravel_datatable').DataTable({
         processing: true,
         serverSide: true,
         ajax: {
          url: "{{ url('products-listn') }}",
          type: 'GET',
          data: function (d) {
          d.start_date = $('#start_date').val();
          d.end_date = $('#end_date').val();
          }
         },
         columns: [
                  { data: 'id', name: 'id' },
                  { data: 'product', name: 'product' },
                  { data: 'warehouse', name: 'warehouse' },
                  { data: 'input', name: 'input' },
                  { data: 'output', name: 'output' }
               ]
      });
   });
 
  $('#btnFiterSubmitSearch').click(function(){
     $('#laravel_datatable').DataTable().draw(true);
  });
</script>

My Controller

public function prodsListn()
    {   
        $adminsQuery = Admin::query();
            //$adminQuery = Admin::query();
        //$balance = $adminsQuery->select('input')-$adminsQuery->select('output');
        //return $balance;
 
        $start_date = (!empty($_GET["start_date"])) ? ($_GET["start_date"]) : ('');
        $end_date = (!empty($_GET["end_date"])) ? ($_GET["end_date"]) : ('');
 
        if($start_date && $end_date){
 
         $start_date = date('Y-m-d', strtotime($start_date));
         $end_date = date('Y-m-d', strtotime($end_date));
 
         $adminsQuery->whereRaw("date(admins.date) >= '" . $start_date . "' AND date(admins.date) <= '" . $end_date . "'");
        }
        $admins = $adminsQuery->select('*')->groupBy('warehouse_id','product_id');
        return datatables()->of($admins)
            ->make(true);
    }
Activity icon

Awarded Best Reply on How Can I Group And List Products With Warehouses

I solved it

Activity icon

Started a new Conversation I Want To Querry This By $product And $warehouse

public function prodsList()
    {   
        $adminsQuery = Admin::query();
 
        $start_date = (!empty($_GET["start_date"])) ? ($_GET["start_date"]) : ('');
        $end_date = (!empty($_GET["end_date"])) ? ($_GET["end_date"]) : ('');
 
        if($start_date && $end_date){
 
         $start_date = date('Y-m-d', strtotime($start_date));
         $end_date = date('Y-m-d', strtotime($end_date));
 
         $adminsQuery->whereRaw("date(admins.date) >= '" . $start_date . "' AND date(admins.date) <= '" . $end_date . "'");
        }
        $admins = $adminsQuery->select('*');
        return datatables()->of($admins)
            ->make(true);
    }
Activity icon

Replied to Where Are You All From?

Abuja, Nigeria

Activity icon

Started a new Conversation How Can I Group And List Products With Warehouses

i have a search and sort system using ajax, i am able to display each product with warehouses separately, but i want to group all products in a particular warehouse together, not each one displaying separately.

My controller

public function index()
    {
        return view('prods');
    }
    public function prodsList()
    {   
        $adminsQuery = Admin::query();
 
        $start_date = (!empty($_GET["start_date"])) ? ($_GET["start_date"]) : ('');
        $end_date = (!empty($_GET["end_date"])) ? ($_GET["end_date"]) : ('');
 
        if($start_date && $end_date){
 
         $start_date = date('Y-m-d', strtotime($start_date));
         $end_date = date('Y-m-d', strtotime($end_date));
 
         $adminsQuery->whereRaw("date(admins.date) >= '" . $start_date . "' AND date(admins.date) <= '" . $end_date . "'");
        }
        $admins = $adminsQuery->select('*');
        return datatables()->of($admins)
            ->make(true);
    }

My view

<div class="row">
    <div class="form-group col-md-6">
    <h5>Start Date <span class="text-danger"></span></h5>
    <div class="controls">
        <input type="date" name="start_date" id="start_date" class="form-control datepicker-autoclose" placeholder="Please select start date"> <div class="help-block"></div></div>
    </div>
    <div class="form-group col-md-6">
    <h5>End Date <span class="text-danger"></span></h5>
    <div class="controls">
        <input type="date" name="end_date" id="end_date" class="form-control datepicker-autoclose" placeholder="Please select end date"> <div class="help-block"></div></div>
    </div>
    <div class="text-left" style="
    margin-left: 15px;
    ">
    <button type="text" id="btnFiterSubmitSearch" class="btn btn-info">Submit</button>
    </div>
    </div>
    <br>
    <table class="table table-bordered" id="laravel_datatable">
       <thead>
          <tr>
             <th>Id</th>
             <th>Product</th>
             <th>Warehouse</th>
             <th>Input</th>
             <th>Output</th>
             <th>Customer Name</th>
             <th>Shop</th>
             <th>Order Number</th>
             <th>Date</th>
          </tr>
       </thead>
    </table>
 </div>
 <script>
function myFunction() {
  window.print();
}
</script>
 <script>
 $(document).ready( function () {
     $.ajaxSetup({
          headers: {
              'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
          }
      });
  $('#laravel_datatable').DataTable({
         processing: true,
         serverSide: true,
         ajax: {
          url: "{{ url('products-list') }}",
          type: 'GET',
          data: function (d) {
          d.start_date = $('#start_date').val();
          d.end_date = $('#end_date').val();
          }
         },
         columns: [
                  { data: 'id', name: 'id' },
                  { data: 'product', name: 'product' },
                  { data: 'warehouse', name: 'warehouse' },
                  { data: 'input', name: 'input' },
                  { data: 'output', name: 'output' },
                  { data: 'customer_name', name: 'customer_name' },
                  { data: 'shop', name: 'shop' },
                  { data: 'order_number', name: 'order_number' },
                  { data: 'date', name: 'date' },
               ]
      });
Activity icon

Started a new Conversation I Want To Add $input To $balance Value From A Different Table

I want to be add input to balance once the input is saved from form. The values of the input is saved in a db table called $notes, while the $balance is saved in a table called $products.

My form

 <input type="hidden" name="product_id" value="{{$note->product_id}}">

The dd for balances is null.

My controller

 public function store(Request $request, Note $note)
    {
 
        $product = Product::all();
        $rrr = $request->input('product_id');
        $balances = $rrr->product_n->balance;
        dd($balances);

    }
Feb
22
4 days ago
Activity icon

Replied to I Want To Get Product Name And Id Saved In My Database In My Create

Thanks for explaining. Now i get it!

Activity icon

Replied to I Want To Get Product Name And Id Saved In My Database In My Create

How do i get the product name in my controller? @tray2 I'm sorry if it's silly though!

Activity icon

Replied to I Want To Get Product Name And Id Saved In My Database In My Create

@tray2 I meant without doing this:-

 <option value="{{$product->product}}">{{$product->product}}</option>

 <option value="{{$product->id}}">{{$product->product}}</option>

I am trying to capture the product name which is represented as 'product' and the product id, and save on my db.

Feb
21
5 days ago
Activity icon

Replied to I Want To Get Product Name And Id Saved In My Database In My Create

@sinnbeck @tray2 is there no way i could submit the product and id from form without selection twice?

Activity icon

Replied to I Want To Get Product Name And Id Saved In My Database In My Create

i'm getting this error

ErrorException
Trying to get property 'product' of non-object
Activity icon

Replied to I Want To Get Product Name And Id Saved In My Database In My Create

@sinnbeck product is the name of the product e.g. $product->name is same as $product->product. I want to save the $product->id and the $product->product in my database

Activity icon

Started a new Conversation I Want To Get Product Name And Id Saved In My Database In My Create

My controller

public function store(Request $request, Warehouse $warehouse, Product $product)
    {
        
            $product = $request->product;
            $product_id = $product->id;


        $product = Product::find($id);
        $note = new Note;

        $note->product = $request->input('product');

        $note->product_id = $product_id;
   
        $note->save();
        return redirect('/home')->with('success','Great! Inventory added successfully.');
    }

My form

<div class="col-md-6">
                                    <div class="form-group">
                                        <strong>Select Product</strong>
                                        <select name="product" class="form-control selectpicker" data-live-search="true">
                                            <option value=""></option>
                                            @foreach ($products as $product)
                                            
                                                <option value="{{$product->product}}">{{$product->product}}</option>
                                            <!--<input type="text" name="product" class="form-control" value="{{$product->product}}" readonly>
                                            <input type="hidden" name="product_id" value="{{$product->id}}"> -->
                                            @endforeach
                                        </select>
                                    </div>
                                </div>
Jan
29
4 weeks ago
Jan
18
1 month ago
Activity icon

Replied to I Want My Form To Be Submitted After Successful Payment JS

It's cool. Did you get what I was saying? I'm still building up my js skill.

Jan
17
1 month ago
Activity icon

Replied to Login Error Not Return Message

@mvnobrega I think you should mark @bobbybouwmann as best answer

Activity icon

Replied to I Want My Form To Be Submitted After Successful Payment JS

@bugsysha your reply which was me removing the document.myform.submit(); Was originally my initial code and which only submits on the payment platform and gives a flash message. NOTE it doesn't send a POST request to my controller and I needed it to. What I did was I replaced the callback value with a document.myform.submit();. You really did not understand what I was talking about. I'm glad I got you laughing.🙂

Activity icon

Replied to I Want My Form To Be Submitted After Successful Payment JS

You'd have to place the submit in the call back so there'll be a confirmation before it redirects.

Activity icon

Replied to I Want My Form To Be Submitted After Successful Payment JS

@bugsysha yes I did, but it was submitting without confirming payment

Activity icon

Awarded Best Reply on I Want My Form To Be Submitted After Successful Payment JS

I solved it

callback: function(response){
                        document.myform.submit();
                      }
                    });
Activity icon

Replied to I Want My Form To Be Submitted After Successful Payment JS

I solved it

callback: function(response){
                        document.myform.submit();
                      }
                    });
Jan
16
1 month ago
Activity icon

Replied to I Want My Form To Be Submitted After Successful Payment JS

@bugsysha with just the handler.openIframe(); it just loads the alert, it doesn't submit. I want it to submit once it is successful.

Activity icon

Replied to I Want My Form To Be Submitted After Successful Payment JS

@fylzero It's still responds the same way. Once clicked it submits. It doesn't wait to fail of be successful.

<form action="/membersubscribe" id="myform" name="myform" method="POST">
                    {{csrf_field()}}
                  <script src="https://js.paystack.co/v1/inline.js"></script>
                  <button type="button" onclick="payWithPaystack()"> Pay </button> 
                </form>
 
                <script>
                  function payWithPaystack(){
                    var handler = PaystackPop.setup({
                      key: 'pk_test_0e8187eb43726e09614de21d5a2fe6d48266dbaa',
                      email: '{{ auth()->check()?auth()->user()->email: null}}',
                      plan: 'PLN_b4zn1ixrsn9j87a',
                      currency: "NGN",
                      ref: ''+Math.floor((Math.random() * 1000000000) + 1), // generates a pseudo-unique reference. Please replace with a reference you generated. Or remove the line entirely so our API will generate one for you
                      metadata: {
                        custom_fields: [
                            {
                                display_name: "Mobile Number",
                                variable_name: "mobile_number",
                                value: "+2348012345678"
                            }
                        ]
                      },
                      callback: function(response){
                          alert('success. transaction ref is ' + response.reference);
                      },
                      onClose: function(){
                          alert('window closed');
                      }
                    });
                    
                    function payWithPaystack(event){
                    event.preventDefault();
                    }

                    document.myform.submit();

                    handler.openIframe();
                  }
                </script>
Activity icon

Started a new Conversation I Want My Form To Be Submitted After Successful Payment JS

I want my form to submit after a successful payment. it shouldn't load up automatically.

<form action="####" name="myform" method="POST">
                    {{csrf_field()}}
                    <script src="https://js.paystack.co/v1/inline.js"></script>
                    @cannot ('update', $user->profile)
                        <button type="button" onclick="payWithPaystack()"> {{$prv->amount}}kobo to view </button> 
                    @endcannot
                </form>
 
                <script>
                  function payWithPaystack(){
                    var handler = PaystackPop.setup({
                      key: '####',
                      email: '{{ auth()->check()?auth()->user()->email: null}}',
                      amount: '{{$prv->amount}}',
                      currency: "NGN",
                      ref: ''+Math.floor((Math.random() * 1000000000) + 1), // generates a pseudo-unique reference. Please replace with a reference you generated. Or remove the line entirely so our API will generate one for you
                      metadata: {
                        custom_fields: [
                            {
                                display_name: "Mobile Number",
                                variable_name: "mobile_number",
                                value: "+2348012345678"
                            }
                        ]
                      },
                      callback: function(response){
                          alert('success. transaction ref is ' + response.reference);
                          document.myform.submit();
                      },
                      onClose: function(){
                          alert('window closed');
                      }
                    });

                    document.myform.submit();
                    
                    handler.openIframe();

                  }
                </script>
Jan
06
1 month ago
Activity icon

Awarded Best Reply on Solved! Swift_RfcComplianceException Address In Mailbox Given [emailaddress ] Does Not Comply With RFC 2822, 3.6.2.

you can leave your experience with this type of error here, let's help those just coming in.

Activity icon

Replied to Solved! Swift_RfcComplianceException Address In Mailbox Given [emailaddress ] Does Not Comply With RFC 2822, 3.6.2.

you can leave your experience with this type of error here, let's help those just coming in.

Activity icon

Started a new Conversation Solved! Swift_RfcComplianceException Address In Mailbox Given [emailaddress ] Does Not Comply With RFC 2822, 3.6.2.

I encountered Swift_RfcComplianceException Address in mailbox given [emailaddress ] does not comply with RFC 2822, 3.6.2. when sending welcome mail to my new users.

There was space in my from address. So i corrected it and it worked.
My advice is when you encounter this error, check for empty spaces in your address or your email address format.
Dec
22
2 months ago
Activity icon

Started a new Conversation I Want To Change A Value In My View On My Website That's Already Hosted

I want to change a value on my vue on a website that's already hosted. Do I need to run npm run dev afterwards since it's not on my local machine?

Dec
20
2 months ago
Activity icon

Replied to Follow/unfollow Button Working But Switching To Follow After Clicking

Thanks it's working now... had to restart my pc.

Dec
19
2 months ago
Activity icon

Started a new Conversation How Do I Add Search To My Vuejs Contact List

I want to add search to my contact list. My vue code is below;

<template>
    <div class="contacts-list">
        <ul>
            <li v-for="contact in sortedContacts" :key="contact.id" @click="selectContact(contact)" :class="{ 'selected': contact == selected }">
                <div class="avatar">
                    <img :src="'/storage/avatars/'+contact.avatar" :alt="contact.username">
                    
                </div>
                <div class="contact">
                    <p class="name">{{ contact.name }}</p>
                    <p class="username">{{ contact.username }}</p>
                </div>
                <span class="unread" v-if="contact.unread">{{ contact.unread }}</span>
            </li>
        </ul>
    </div>
</template>

<script>
    export default {
        props: {
            contacts: {
                type: Array,
                default: []
            }
        },
        data() {
            return {
                selected: this.contacts.length ? this.contacts[0] : null
            };
        },
        methods: {
            selectContact(contact) {
                this.selected = contact;

                this.$emit('selected', contact);
            }
        },
        computed: {
            sortedContacts() {
                return _.sortBy(this.contacts, [(contact) => {
                    if (contact == this.selected) {
                        return Infinity;
                    }

                    return contact.unread;
                }]).reverse();
            }
        }
    }
</script>

<style lang="scss" scoped>
.contacts-list {
    flex: 2;
    max-height: 100%;
    height: 600px;
    overflow: scroll;
    border-left: 1px solid #a6a6a6;
    
    ul {
        list-style-type: none;
        padding-left: 0;

        li {
            display: flex;
            padding: 2px;
            border-bottom: 1px solid #aaaaaa;
            height: 80px;
            position: relative;
            cursor: pointer;

            &.selected {
                background: #dfdfdf;
            }

            span.unread {
                background: #82e0a8;
                color: #fff;
                position: absolute;
                right: 11px;
                top: 20px;
                display: flex;
                font-weight: 700;
                min-width: 20px;
                justify-content: center;
                align-items: center;
                line-height: 20px;
                font-size: 12px;
                padding: 0 4px;
                border-radius: 3px;
            }

            .avatar {
                flex: 1;
                display: flex;
                align-items: center;

                img {
                    width: 35px;
                    border-radius: 50%;
                    margin: 0 auto;
                }
            }

            .contact {
                flex: 3;
                font-size: 10px;
                overflow: hidden;
                display: flex;
                flex-direction: column;
                justify-content: center;

                p {
                    margin: 0;

                    &.name {
                        font-weight: bold;
                    }
                }
            }
        }
    }
}
</style>
Activity icon

Awarded Best Reply on My Avatar Is Not Loading On Vue

Fixed

<image :src="'/storage/avatars/'+contact.avatar" :alt="contact.username">
Activity icon

Replied to My Avatar Is Not Loading On Vue

Fixed

<image :src="'/storage/avatars/'+contact.avatar" :alt="contact.username">