tinfoilman

tinfoilman

Member Since 8 Months Ago

Media, PA

Experience Points
22,600
Total
Experience

2,400 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
187
Lessons
Completed
Best Reply Awards
4
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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 5
22,600 XP
Jul
08
2 days ago
Activity icon

Replied to Vue.js Data

I don't know what multiselect is, but if I was making my own template I'd use

<select v-model="selected">
  <option v-for="option in options" v-bind:value="option.id">
    {{ option.name }}
  </option>
</select>
Activity icon

Replied to Need Help For Database Design

There are so many different ways to do this and it really depends on exactly what you're trying to do.

In theory you could keep all of the buying and selling in a single table, but you'd have multiple rows for a single stock to keep track of all the transactions, and need to do some calculations for reporting. Or you could even have 3 tables for buying, selling, and owned shares. Or two tables, for buying and selling, and calculate what's owned and what the profits/losses were. Not so easy!

Activity icon

Replied to Vue.js Data

Try

options[0].name

to get Mister and [1] to get Master

Activity icon

Replied to Random Scheduling Time

If you don't mind creating another table, that should work fine. You could make another job that runs daily at say 9:00 that pre-fills the table by making a random number between 0 and 120, do a Carbon addMinutes(#) to 10:00. Then schedule another job to runs every minute between 10:00 and 12:00. That job will execute any item that matches the current time.

Jul
07
3 days ago
Activity icon

Replied to Input Using Vue Js

No, I was saying to add it as a prop, which is outside of userData, but maybe that is not what you're looking for.

I'm assuming this page will always be for one specific induk_id, because that's what your controller is getting. In that case, the prop can be passed into the component as I suggested.

Will you be using more than one induk_id in that vue?

The way the prop works is like this:

export default {
    props: {
        induk_id: Number,
    },

    data(){
        return{     
            count: 0,
            userData:[{
                induk_id:'',
                nama_barang:'',
                qtt:'',
                satuan:'',
                harga:'',
                harga_total:'',
                keterangan:'',
                status:'Aktif',
            }],
        }
    },
    
    components:{
       
    },
    methods:{
        submit() {
            this.errors = {};
            axios.post('/pengadaan/store_induk_pencairan', this.userData).then(response => {
                window.location = response.data.redirect;
            }).catch(error => {
                if (error.response.status === 422) {
                this.errors = error.response.data.errors || {};
                }
            });
            },
         AddField: function () {
             this.userData.push({ induk_id: '',nama_barang: ''  ,qtt: '' ,satuan: '',harga: '' ,harga_total: '',
             keterangan: '' ,status: 'Aktif',
             });
              }
            
    },
Activity icon

Replied to How To Show Soicial Network?

It looks like your reply is exactly the same thing you posted earlier.

What is your blade template trying to do? I do no understand what this is supposed to do

        $social_name = $social->chump(2);

Also this is going to display the same exact name for each entry, which seems like a strange thing to do.

<th>IDh {{ $social_name->name }}</th>
Jul
06
4 days ago
Activity icon

Replied to How To Show Soicial Network?

I'm trying to figure out what you're trying to do, but it seems like you're trying to do something simple in a very complicated way! There shouldn't be any reason to put php code in your blade template.

So from what I can figure out, you are showing the social ids of a single user? That user has a field called 'social_id' that has several different social ids in it? And then you are trying to get the social network details of each one that the user has, and display them one at a time in your blade?

Activity icon

Replied to Ajax Refresh Duplicates Window

I just realized my suggestion wasn't going to work anyway. Sorry.

What is it getting with ajax if it has no url?

When you say it duplicates in the window, do you mean in the console.log? Or just in the html?

Activity icon

Replied to Ajax Refresh Duplicates Window

Try this

 $('.try').click(function(){
            var brand = [];
            $('.try').each(function(){
                if($(this).is(":checked")){

                    brand.push($(this).val());
                } else {
		    brand.splice($(this).val());
            });
            Finalbrand  = brand.toString();
Activity icon

Replied to Input Using Vue Js

You can pass values to your vue component by using props in your blade file, like this:

<component-name :induk_id="123"></component-name>

then in your vue.js file you would add the props section to grab it:

props: {
  induck_id: Number,
},
Activity icon

Replied to How To Include Several "show" Blades Inside An "index" Blade?

Can't you use a @foreach in your blade? I've never tried, but you may even be able to @include within each one.

@foreach ($ids as $id)
    <p>This is card {{ $id->whatever }}</p>
@endforeach
Activity icon

Replied to Vue Js Component Not Registering

Does it work if you put some code in your multi template like you did with the other one? I don't know if the error is because you have zero script in it.

<template>
    <div>
        <input type="text" placeholder="write something...">
    </div>
</template>

<script>
    export default {
        mounted() {
            console.log('Component mounted.')
        }
    }
</script>
Activity icon

Replied to Is There A Way To Convert A Full Date To Milliseconds?

Use microtime(true) instead of now() to get the timestamp in milliseconds.

Jul
05
5 days ago
Activity icon

Replied to Declare A Vue Component Locally.

I've read that section in vuejs before but it still doesn't spell it out clearly enough for someone is dumb as me. Does it mean this:

 * First we will load all of this project's JavaScript dependencies which
 * includes Vue and other libraries. It is a great starting point when
 * building robust, powerful web applications using Vue and Laravel.
 */

require('./bootstrap');

window.Vue = require('vue');

/**
 * The following block of code may be used to automatically register your
 * Vue components. It will recursively scan this directory for the Vue
 * components and automatically register them with their "basename".
 *
 * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
 */

// const files = require.context('./', true, /\.vue$/i)
// files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))

var follow_button = {'./components/FollowButton.vue'};
var comments = {'./components/Comments.vue'};
...

/**
 * Next, we will create a fresh Vue application instance and attach it to
 * the page. Then, you may begin adding components to this application
 * or customize the JavaScript scaffolding to fit your unique needs.
 */

const app = new Vue({
    el: '#app',
	components: {
	'follow-button': follow_button,
	'comments': comments,
	...
	}
});

And then how do you use them in the .vue file of Laravel? Same way as when they were global?

Activity icon

Replied to Eager Loading With Single Row

Your last line of code isn't right. You can't do another get() on it. All you need is:

$user_verification = UserVerification::find(verification_id);
return $user_verification->user;
Activity icon

Replied to Should I Buy A2hosting.com To Host Laravel?

Sorry, I didn't mean no support from the company. I mean no support from the public because he said he couldn't find any youtube videos or tutorials. I'd stick with a trusted host like Digitalocean considering the price is similar.

I checked out their site and they do seem to provide a legit service, but their page layout reminds me of tried-to-make-a-quick-buck dropshipping site made on Wordpress. Just look at the gigantic 5-star review section, and generic news articles that are all dated in the past month.

Activity icon

Replied to Should I Buy A2hosting.com To Host Laravel?

They just call it "Laravel hosting" and I have really no idea what it is. I can't even find any youtube video of anybody using it/tutorial. I have a little idea what I'm really want. They are not saying what are they offering. So it makes me super confused.

You just answered your own question. Don't go using some place that can't even say what they're offering and has no public support. And with a name like that, they could be a reseller. Also, claiming "Laravel hosting" means nothing. Even a crappy windows 2008 server can be setup to run a Laravel site.

Activity icon

Started a new Conversation Vapor Memory Allocation Affects Speed, Oops

This isn't a question, but a heads up that I didn't know about. About a week ago I tried changing the memory of my production app from 1024 to 128MB. My thinking was that Telescope was telling me I was rarely using more than 4MB of memory to serve a request, so why the heck do I need 1024MB in Lambda?

The last few days I was catching on to the fact that my site seemed to be slower. At first I thought maybe it was me adding more crap in the code, and then I thought maybe AWS was having a bad few days LOL. But that didn't make sense. My page requests were taking over a second sometimes. A huge difference in speed when browsing.

So tonight I did some Googling to see if it's possible to increase CPU on Lambda, and what what do you know, hidden away in the docs it said that CPU and other resources are scaled proportionally with the memory! Well that sucks, but I can see how it sort of makes sense. So I put my memory back up to 1024MB and pages are loading 2-5x faster now, yay! Wish I knew this earlier. In fact, since you're charged by 100ms increments, it's not much more expensive to go with the higher memory with less compute time.

Activity icon

Replied to Need Help Connecting To Database

Are you asking how to connect to your database in your Laravel app? You said you connected with MySQLWorkbench, but that is a standalone application to let you view your mySQL database and has nothing to do with Laravel.

You need to configure your connection to your Laravel project in the .env folder. There are several variables that all start with DB_

Jul
04
6 days ago
Activity icon

Awarded Best Reply on Loop On A Hasmany Relationship

Oh I see what you're doing. My code is wrong. You're grabbing one menu item that has many recipes. The problem is you're using a Get command, so you'd have to access it as $menu[0].

What you should do is something like

$menu = Menu::with('recipes')->where('id', $id)->first();

and then I think your original foreach will work

Activity icon

Replied to Loop On A Hasmany Relationship

what results are you getting when you make the query?

try return $menus, or dd($menus)

Also, I'm not sure how you'd get any response because you're not actually doing anything in the foreach.

Activity icon

Replied to Loop On A Hasmany Relationship

Oh I see what you're doing. My code is wrong. You're grabbing one menu item that has many recipes. The problem is you're using a Get command, so you'd have to access it as $menu[0].

What you should do is something like

$menu = Menu::with('recipes')->where('id', $id)->first();

and then I think your original foreach will work

Activity icon

Replied to Loop On A Hasmany Relationship

foreach($menu as $recipe){
	$recipe->recipe_name;
    }

But it would be cleaner to do

$menus = Menu::with('recipes')->where('id', $id)->get();

then

foreach($menus as $menu){
	$menu->recipe_name;
    }
Activity icon

Replied to Random Scheduling Time

This may not help you, because I don't think it will be random, but you can schedule things to happen between those times like this:

$schedule->command('reminders:send')
                    ->hourly()
                    ->between('10:00', '12:00');
Activity icon

Replied to Attempting To Connect To Database

Or you could just take advantage of what you've paid for and watch this:

https://laracasts.com/series/laravel-6-from-scratch/episodes/9

Activity icon

Replied to Attempting To Connect To Database

Is that a question or a statement?

If it's a question, you're going to need to be more specific than that. But your database configuration can bet setup in the .env file.

Activity icon

Replied to Why AWS Over Digitalocean?

If Digitalocean fits your needs, I'd say it's a no brainer. AWS has a lot more services though, especially if you're looking for serverless applications, security products, machine learning, and lots of other stuff. I like it for the serverless.

Jul
03
1 week ago
Activity icon

Started a new Conversation Redis Sorted Set Commands

Redis really frustrates me. Most documentation on the web is for running it on the command line, which I can get to work fine, but trying to do the same thing in my Laravel Vapor app always takes me a lot of fooling around. Some things work and some things don't. This one is really killing me.

I have a sorted set with key name 'reviews' that has 500 members. I want to be able to pull out 20 at a time. The Redis command should be:

ZREVRANGEBYSCORE key max min [WITHSCORES] [LIMIT offset count]

I have no problem getting the complete list in my app using:

Redis::zrevrangebyscore('reviews', 'inf', 0)

But how do I insert the Limit offset count part of the command? The closest I've come to making it work is this:

Redis::zrevrangebyscore('reviews', 'inf', 0, array('limit' => array(0, 20)));

The exception I get in Telescope is:

255      * @param  mixed  $min

256      * @param  mixed  $max

257      * @param  array  $options

258      * @return array

259      */

260     public function zrevrangebyscore($key, $min, $max, $options = [])

261     {

262         if (isset($options['limit'])) {

263             $options['limit'] = [

264                 $options['limit']['offset'],

265                 $options['limit']['count'],

266             ];

267         }

268 

269         return $this->command('zRevRangeByScore', [$key, $min, $max, $options]);

270     }

271 

272     /**

273      * Find the intersection between sets and store in a new set.

274      *

Can anyone please help me figure out what that exception is expecting to receive?

Jul
01
1 week ago
Activity icon

Replied to Where Are You All From?

Media, PA, USA, just outside of Philadelphia!

Activity icon

Replied to How To Get REMOTE_ADDR If Your Using Vapor

Right on. I was scratching my head over that one too! Took me hours to figure it out.

Unfortunately, there are still a lot of mysteries with using Vapor. So little resources out there, but I do love it.

Activity icon

Replied to How To Handle Views With Nav-link Or Navs And Get A Neat URL?

If the url were to say accounts/add, then your Route in web.php would need to be

Route::get('accounts/add', '[email protected]')->name('accounts.add');

changing your href to:

               href="/accounts/add" name="add" id="add">Add</a>

will make it go there and look correct in the browser

Activity icon

Awarded Best Reply on Please Help With Views, Need Some Guidance And Help

You have an extra } in your form action, so it's sticking it in the url, here:

<div class="col-sm">
            <form action="{{route('accounts.create')}}}" method="get" class="pb-15" autocomplete="off">
Activity icon

Replied to Please Help With Views, Need Some Guidance And Help

Did you take out the extra } in the add form too? It was in both. Other than that, it's hard to tell from here.

Activity icon

Replied to Integrate Vue Admin Template Into Laravel + Vue Project

Have you contacted the creator? Doesn't Themeforest include a few months of support from the seller with purchase? They can probably help you out much faster than anyone here, without knowing the template.

Activity icon

Replied to Please Help With Views, Need Some Guidance And Help

You have an extra } in your form action, so it's sticking it in the url, here:

<div class="col-sm">
            <form action="{{route('accounts.create')}}}" method="get" class="pb-15" autocomplete="off">
Jun
30
1 week ago
Activity icon

Replied to What Is Your Favorite Deployment Pipeline?

Laravel Vapor.

vapor deploy production -> Boom.

Seriously.

Jun
29
1 week ago
Activity icon

Awarded Best Reply on Link To A Dynamic Page Number

You shouldn't have to pull any message from the database. Just grab the count of messages in that particular topic that have an id less than the one you're looking for. Something like this:

$messagePosition = Message::where('topic_id', $topic_id)->where('id', '<=', $message_id)->count();
Jun
28
1 week ago
Activity icon

Replied to Link To A Dynamic Page Number

Ah, I don't know how you'd ever do that for multiple message links in a single page without N+1.

But do you really have to know the page number of each one of those messages? Put the message number in your route and let the controller figure out which page to show. That way it's only calculating position when it's needed.

/topics/{topic_id}/{message_id} 
Activity icon

Replied to Link To A Dynamic Page Number

You shouldn't have to pull any message from the database. Just grab the count of messages in that particular topic that have an id less than the one you're looking for. Something like this:

$messagePosition = Message::where('topic_id', $topic_id)->where('id', '<=', $message_id)->count();
Jun
26
2 weeks ago
Activity icon

Replied to Encryption Of ID

The route model binding example should do that automatically. You provide it with a field in your table that has to be unique, and by making it the route key name it should update records automatically without ever needing to know what the primary key ID is.

So what you can do is create a new column in your user table called 'token' or whatever you want, and fill it with a random string. Then set that as your route key name and you'll never need to feed it the primary key ID for updates.

Activity icon

Replied to Restrict User From Using The Create Route A Second Time

Oops, I didn't realize the code is using the same form for both creating and editing. It actually looks like it should work because the edit template decides where to send it by checking to see if they are signed in. The method I post isn't appropriate.

Activity icon

Replied to Encryption Of ID

Oh, and you'll want to use a different route key to make things easier. Put this in your model, where 'slug' is whatever you call your random key that shows up to the client:

/**
 * Get the route key for the model.
 *
 * @return string
 */
public function getRouteKeyName()
{
    return 'slug';
}

See https://laravel.com/docs/7.x/routing#route-model-binding

Activity icon

Replied to Encryption Of ID

You shouldn't have to use the primary key in any forms to the client. Mine are not visible because I don't want people to be able to pull data easily by incrementing through sequential numbers in page requests.

I use a slug for the ID to the client, but you could easily create any sort of random value.

Activity icon

Replied to Restrict User From Using The Create Route A Second Time

There's probably a cleaner way, but you can just put this int he Create controller and it will redirect them to the edit controller if they are signed in:

use Illuminate\Support\Facades\Auth;

if (Auth::check()) {
    	// The user is logged in...
	return redirect()->action('[email protected]');
}
Activity icon

Replied to Restrict User From Using The Create Route A Second Time

Are you trying to prevent people from purposely trying to create multiple accounts? Or just preventing the site from letting people see the route if they are signed in?

Jun
22
2 weeks ago
Activity icon

Replied to Cannot Keep Multi-row Added Old Values When Validation Failed

I don't know the correct syntax, but the problem looks like every iteration is assigning the old value as 'company' when in fact that value name doesn't exist. It should be addmore[i][company]

Activity icon

Replied to How Can I Fetch A Data From 3 Tables With Relationship

Do you have a country_id in your users table? It doesn't look like it, and I think you need one in order for the public function country() to work in your User Model.

Activity icon

Replied to Any Suggestions For "Laravel Projects" To Build :) ?

Make a site about some kind of hobby that has a directory of items. Users can register, add items to the database, and have profiles of each item. You can grow it from there, letting people search, review the items, comment on them, attach photos.

You can do this for almost anything! A good way to hit all of the basics.

Jun
19
3 weeks ago
Activity icon

Replied to Delete A Post With Your Receved Messages In One Step.

Also, you may want to consider a foreign key constraint on your services, photos and messages.

$table_name->foreignId('house_id')
      ->constrained()
      ->onDelete('cascade');

Put that in each of your migrations and it will automatically remove them when you delete the house.

Jun
16
3 weeks ago
Activity icon

Replied to ErrorException Illegal Offset Type In Isset Or Empty

Since you're taking the value of $abstract and immediately putting it into an array, it's going to give you an error any time the $abstract value doesn't correspond to to an index in the array. Try checking for a value of $abstract before that line.