bobbybouwmann

Developer at Enrise

Hire Me

Experience

1,181,945

1433 Best Reply Awards

  • Member Since 4 Years Ago
  • 1278 Lessons Completed
  • 14 Favorites

19th October, 2018

bobbybouwmann left a reply on Using PHP Tags In Blade • 1 day ago

  1. <?php echo 'if you want to serve PHP code in XHTML or XML documents, use these tags'; ?>

  2. You can use the short echo tag to <?= 'print this string' ?>. It's always enabled in PHP 5.4.0 and later, and is equivalent to <?php echo 'print this string' ?>.

  3. <? echo 'this code is within short tags, but will only work '. 'if short_open_tag is enabled'; ?>

  4. echo 'some editors (like FrontPage) don\'t like processing instructions within these tags'; This syntax is removed in PHP 7.0.0.
  5. <% echo 'You may optionally use ASP-style tags'; %> Code within these tags <%= $variable; %> is a shortcut for this code <% echo $variable; %> Both of these syntaxes are removed in PHP 7.0.0.

bobbybouwmann left a reply on Using PHP Tags In Blade • 1 day ago

You need to use the correct php tags

<?php $code ?>

bobbybouwmann left a reply on Why Did Not Save Form Data With Validation In The Controller? • 2 days ago

Are you sure all fields are checked for in your view? You can easily check that by adding the validation like you have now and dumping out all the errors you can back

{{ var_dump($errors->all()) }}

If you fill in everything correctly you should see some extra error in there and therefore the validation fails!

17th October, 2018

bobbybouwmann left a reply on User_id D'ont Sent With Vue Event Bus !!! • 3 days ago

Are you sure this.author_id is set? As far as I know your props needs to be camalcased

 <vue-comment post_id="{{$post->slug}}" author-id="{{\Auth::id()}}"></vue-comment>

export default {
    props : [
        'authorId'
    ],

        data () {
        return {
                    userId: this.authorId
        }
    },
}

Note in the template that you use author-id and in your component authorId!

Documentation: https://vuejs.org/v2/guide/components-props.html#Prop-Casing-camelCase-vs-kebab-case

bobbybouwmann left a reply on Storage::download() Not Working Properly • 3 days ago

What is not working? No response? No file?

You might need to add the headers for the filetype to the download method as the third argument!

Documentation: https://laravel.com/docs/5.7/filesystem#retrieving-files

bobbybouwmann left a reply on Using Socialite With Logged On User • 3 days ago

@Chaeril Can I help you in any other way?

bobbybouwmann left a reply on Why Does This Code Returns An Empty Collection • 3 days ago

@Snapey Smile a bit dude! He actually tried to show his code properly but it failed! Shit happens man

bobbybouwmann left a reply on Fbfun.in Is Currently Unable To Handle This Request. HTTP ERROR 500 In Laravel Script Installation • 3 days ago

Your first reply tells you that it's calling the method send on a string. So that can be anything. Just check the line of your error

Your second reply tells you that you can't connect with the database. You need to setup a database to make everything work!

16th October, 2018

bobbybouwmann left a reply on Why Does This Code Returns An Empty Collection • 5 days ago

This is not valid code!

$i = App\courseInstructor::where('user_id','2' and 'course_id','6')->get()

Instead you have three options here

$i = App\courseInstructor::where('user_id', '2')
    ->where('course_id', '6')
    ->get();

// Or
$i = App\courseInstructor::where(['user_id' => '2', 'course_id' => '6'])->get();

// Or
$i = App\courseInstructor::where([
    ['user_id', '=', '2'],
    ['course_id', '=', '6'],
])->get();

bobbybouwmann left a reply on Splice Deleting Last Element • 5 days ago

Your code looks correct. Are you sure the index is correct?

Here is a working example, but it's exactly the same as yours: https://stackoverflow.com/questions/43046332/how-to-remove-an-item-from-an-array-in-vue-js

bobbybouwmann left a reply on Can't Install Laravel Due To "the Requested PHP Extension Zip Is Missing From Your System" • 5 days ago

@cuwa Right? Happens a lot hehe! I'm not even disappointed anymore...

bobbybouwmann left a reply on Using Socialite With Logged On User • 5 days ago

@Chaeril Your last reply has nothing to do with your original question right?

Anyway, you don't have to remove the middleware from the LoginController. Instead you should create a seperate controller for the socialite connection that is accessible for an authenticate or guest user.

bobbybouwmann left a reply on Fbfun.in Is Currently Unable To Handle This Request. HTTP ERROR 500 In Laravel Script Installation • 5 days ago

Did you check the logs? Without information we can't tell what the problem is!

You can find the logs in storage/logs/laravel.log. Otherwise you should be looking in your server logs.

bobbybouwmann left a reply on Attempting To Broadcast With Pusher... Not Working :-( • 5 days ago

@bizzybob Yeah, the cluster is required since a few years! Well good catch!

Let me know if you have more questions

bobbybouwmann left a reply on Expected "indent", Got "eos" (Stylus) • 5 days ago

It can also be a whitespace that shouldn't be there!

bobbybouwmann left a reply on Expected "indent", Got "eos" (Stylus) • 5 days ago

Mmhh this can be anything! Did you check for double opening brackets { or closing brackets }?

It also happend to me once when I had this in my code

// Notice the double #
white ##fff 

bobbybouwmann left a reply on Understanding Codes • 5 days ago

Well in this case it will always work. Even if you don't have $data set.

So this bit of code

value="{{ ($data) ? $data->id : "" }}"

When ($data) is NOT null it will perform the action behind the ?. If ($data) evaluates to null it will perform the action behind the :. So in your case on create $data is null so you will show an empty string. On edit you have data so you show the $data->id value in the input

Now for the old() method

value="{{ ($data) ? $data->nama : old('nama') }}"

The old method will check in the session if one of the fields has been send in the previous request. So whenever you have a validation error laravel will return to the previous view where your form is. With that it will send the data that was posted in the request before that. You can retrieve that data using old. That's basically it!

Documentation: https://laravel.com/docs/5.7/requests#old-input

bobbybouwmann left a reply on Using Socialite With Logged On User • 5 days ago

The process is still the same right? You check if you already have the user authenticated once. If not you will send them to Facebook and they will grant you permissions. After that you get the user back.

It's up to you what to do with the data. In your case you probably need to store the token you get back from Facebook in your database to see if you already have authenticate the user with facebook. After that you can login in the user if they are not logged in or skip that part. In the end you will work with the same User object right?

bobbybouwmann left a reply on Checkbox Doesn't Work In Lc_chat... • 5 days ago

There is no field called value in here! The value of $setfield->code is the name of the input right now.

Instead you need to do something like this

{{ Form::checkbox('value', '1', true) }}
{{ Form::checkbox($name, $value, $checked) }}

It looks like $setfield->code is not returning value right now!

Documentation: https://laravelcollective.com/docs/master/html#checkboxes-and-radio-buttons

15th October, 2018

bobbybouwmann left a reply on #In Laravel Application I'm Trying To Achieve A Button Inside View That Can Allow User To Download File Without Navigating To Any Other View Or Route • 5 days ago

Is your file containing any forward slashes (/)? If so Laravel will see it as a normal route. For example a academic_attachment that looks like this files/attachment.png will result in this url

/consultants/download/files/attachment.png

Laravel will see this as a separate route since it doesn't match your defined route.

You have two options to fix this. Either use another identification to determine the attachment. For example the consultant id and based on that id you retrieve the file and return that.

Route::get('/consultants/download/{$consultant}', '[email protected]')->name('downloads');

public function getDownload(Consultant $consultant) 
{
    $filename = $consultant->academic_attachment;
    $file_path = public_path() . "/" . $filename; 

    return response()->download($file_path); 
}

Another option is for example replacing the forward slash with an underscore or another character to make the url valid. However the best way is the first option ;)

bobbybouwmann left a reply on Display Laravel Echo Pusher Event Values In Vue Component • 5 days ago

Your javascript is incorrect. You need to use this.msg. Also you need to define your property as a data attribute in Vue.

data() {
    return {
        'msg' => null,
    }
},

created() {
    window.Echo.channel('progressBar').listen('UpdateProgressData', {{ message }} => {
        this.msg = message;
    });
}

bobbybouwmann left a reply on Using Hotreload With Workbox-webpack-plugin • 5 days ago

Here is an example with everything you need: https://gist.github.com/peakhmr/1cd4609620875db4e00d46ef51bb9cf5

With that example you can run npm run hot to have hot-reload and everything else enabled ;)

bobbybouwmann left a reply on Attempting To Broadcast With Pusher... Not Working :-( • 5 days ago

You can see if the event has been broadcasted by looking inside your pusher dashboard. It should appear there!

Anyway, I see that you broadcast your message to some channel, but you don't listen to that channel. I would expect something like this in your javascript

 Echo.channel('bobtest')
    .listen('ThreadMessageCreated', (response) => {
        // Do something with the response
    });

It seems that you have switched the channel with the event name!

bobbybouwmann left a reply on Writing To Syslog With Laravel. • 5 days ago

Laravel has the option to activate the syslog handler

https://laravel.com/docs/5.7/logging#configuration

By default the syslog is written to some location based on your php.ini configuration. In your php application you can get that location by calling and outputting ini_get('error_log');. You can also see this in the php.ini files or by checking phpinfo();.

Since laravel 5.6 you can create multiple log channels. This way you can write logs to multiple files or with multiple levels. Check your config/logging.php for all the options :D

bobbybouwmann left a reply on Base Table Or View Not Found On Production, But Not On Local • 5 days ago

I always keep databases to lower case to prevent these kind of issues

bobbybouwmann left a reply on Inserting Data On Button Click • 5 days ago

What I showed you is enough. The post is inserted to the controller by ID. Laravel will automatically convert the id to a model. The is called route model binding. You can read more about it here: https://laravel.com/docs/5.7/routing#route-model-binding

bobbybouwmann left a reply on Eloquent Error • 5 days ago

@CarlosPleitez Do you still have a question or am I missing something?

bobbybouwmann left a reply on Custom Implement Auth::routes(['verify' => True]) • 5 days ago

The validate signature part is part of the upgrade to 5.7. It's indeed used in the verify steps. Good catch!

bobbybouwmann left a reply on Can't Install Laravel Due To "the Requested PHP Extension Zip Is Missing From Your System" • 5 days ago

Yeah, that's exactly what my answer was ;) I could have copied the answer from stackoverflow though!

bobbybouwmann left a reply on Barryvdh/laravel-debugbar Does Not Appear In Laravel5.6 • 5 days ago

How did you install the package? Do you see the barryvdh/laravel-debugbar directory in the vendor directory?

bobbybouwmann left a reply on Barryvdh/laravel-debugbar Does Not Appear In Laravel5.6 • 5 days ago

Your APP_ENV needs to be local. For the rest the service provider should work out of the box!

bobbybouwmann left a reply on Api Resource With Multiple Version Of Same Model • 6 days ago

Yeah, you need to create multiple resources for that ;)

bobbybouwmann left a reply on Problem With Query Where Select • 6 days ago

Your form fields always need to be inside the <form> and </form> tags. Otherwise your browser doesn't understand how to post it. After that you should be able to get it from the request.

Note that you can't post to a get route. In this case the show route is already a get route and you can't combine the two. Instead you can use a query parameter in your url to do the filter

<form method="GET" action="{{ route('usuario.show', $id) }}">

    // Your select here
    // Your submit button here

</form>

// In your controller you can access the filter like so
public function show(Request $request, $id)
{
    $filter = $request->get('tipo');

    // your query with above filter

    // The response here
}

14th October, 2018

bobbybouwmann left a reply on Ue Multi Mysql Database In Laravel • 6 days ago

A multi-tenant setup with multiple databases might sound like a better solution here.

This might help: https://laracasts.com/discuss/channels/laravel/migration-on-multi-tenant-multi-database-app

bobbybouwmann left a reply on Ue Multi Mysql Database In Laravel • 1 week ago

You can add as many as you want. It's just a config file and Laravel will read from it. However if you have over 10 connections you might want to abstract it something else.

12th October, 2018

bobbybouwmann left a reply on How To Get Laravel 5.7 Seeded Blade Localization Syntax To Render In Blade? • 1 week ago

First of all it's a really bad idea to store the form of your page in the database. Instead you should be saving a list of fields with their type for example in your database.

Anyway. In your case you are storing blade syntax in the database. When you echo it out Laravel doesn't know it's blade because it comes from the database. Instead you need to either parse the blade before you insert it in the database or before you output it.

You can do that by fielding a new View with that data and then render that to some output.

bobbybouwmann left a reply on Controller Method Visibility - Protected Vs. Public • 1 week ago

  • public scope to make that variable/function available from anywhere, other classes and instances of the object.

  • protected scope when you want to make your variable/function visible in all classes that extend current class including the parent class.

  • private scope when you want your variable/function to be visible in its own class only.

When calling a route Laravel will new up the class and call the given method on it. Both the public and protected scope make this possible.

Basically Laravel will do something like this in the most basic form:

$controller = App/Http/Controllers/MyController::class;
$method = 'index';

$response = (new $controller)->$method();

bobbybouwmann left a reply on Eloquent Error • 1 week ago

You need to pass the $id to the callback using use ($id)

public function show($id)
{
    $roles = Rol::whereHas('RolOperador', function($query) use ($id) {
        $query->where('operadores_login', $id)->get();
    })->get();
}

bobbybouwmann left a reply on How To Update PHP Version In Laravel. • 1 week ago

Laravel 5.3 supports PHP 5.6.4 or up. So it's not your application you need to upgrade, but you need to upgrade the PHP version of your local or production environment.

If you run php --version you will see what php version you have on your server or local environment.

bobbybouwmann left a reply on Help Trying To Table In Markdown • 1 week ago

Not all markdown editors support tables! Currently Laracasts doesn't support this.

See this list for what is supported: https://help.github.com/articles/basic-writing-and-formatting-syntax/

bobbybouwmann left a reply on Problem With Query Where Select • 1 week ago

This seems to be invalid

<form action="{{route('usuario.show', $id->$usuario_ad)}}" method="POST">

Note the $id->$usuario_ad. I think you need one of the parameters here instead of both!

bobbybouwmann left a reply on How To Cleanly Delete All Access And Refresh Tokens After Password Reset? • 1 week ago

You already have an option to delete refresh tokens that are not used anymore

Passport::pruneRevokedTokens();

You can for example put this in a cronjob of your scheduler.

Now for deleting the tokens. Yes indeed your refresh tokens still exists, however they are invalid as well. If the refresh token cannot match with the access token it's seen as invalid. Since you already delete the access token the refresh token cannot be used anymore as well ;)

This thread might be interesting for you as well: https://stackoverflow.com/questions/39467566/laravel-passport-multiple-connexions-via-password-client/39802823#39802823

bobbybouwmann left a reply on Unable To Probe Video.m4 • 1 week ago

What have you tried? Where are you stuck? Just sharing a tutorial doesn't show us your progress! Maybe you missed a step?

bobbybouwmann left a reply on Auto Logout If No Activity In Given Time • 1 week ago

Yeah you can do that. If you set the session engine for authentication to database you get a user_id as well in your database for that session. With that you can then delete that session from the database. On the next request of the user it will be logged out, because the session is gone.

This might help as well: https://laravel.com/docs/5.7/authentication#logging-out

11th October, 2018

bobbybouwmann left a reply on Download A File After Form Submission Laravel 5.6 • 1 week ago

From your question I understand that you want to redirect the user to some page but also download a file right? Well this cannot be done, because your browser can only handle one response at the time. So either the redirect or the download response.

This is an ugly work around, but works AFAIK: https://stackoverflow.com/questions/25624927/how-do-i-redirect-after-download-in-laravel

bobbybouwmann left a reply on Credit Card Credential • 1 week ago

Stripe won't store the actual credit card credentials for you. It will store some payment token that can be used to charge the card. This token can only be used once and has to be refreshed after usage.

https://stripe.com/docs/api#charge_object

Not really sure if you want to know the technical of the functional side of it..

bobbybouwmann left a reply on Inserting Data On Button Click • 1 week ago

You can do it without javascript ;)

Let's say you have aPost model that you want to convert to an Article model. You would do something like this

// web.php
Route::post('posts/{post}/article', '[email protected]')->name('posts.to.article');

// Example controller
class PostToArticleController extends Controller
{
    public function store(Post $post) 
    {
        $article->create([
            'title' => $post->title,
            'content => $post->body,
        ]);

        $post->delete();

        return redirect()->route('posts.index);
    }
}

Now that we have the logic we only need the view to submit to this action

<form method="POST" action="{{ route('posts.to.article', $post->id) }}">
    @csrf

    <button type="submit">Migrate post to article</button>
</form>

Now this should work for you. Note that this will refresh the view you currently on because of the redirect.

If you don't want a refresh of the page you have to use javascript. So you can then do an ajax request, perform the same action and then with javascript remove the item from the list. However that is up to you ;)

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.