wilburpowery

Full Stack Web Developer at BVMedia

Hire Me

Experience

71,530

27 Best Reply Awards

  • Member Since 1 Year Ago
  • 520 Lessons Completed
  • 0 Favorites

20th August, 2018

wilburpowery left a reply on Looking Forward To New Layout • 1 day ago

Sometime near the end of the year I assume he'll release it.

15th August, 2018

wilburpowery left a reply on Uploading A Photo Store() Error • 6 days ago

Your form needs to have an enctype attribute. Make sure the generated html has that.

For example:

<form enctype="multipart/form-data">

13th August, 2018

wilburpowery left a reply on Saving HTML Code As HTML Code In Database • 1 week ago

Instead of using a simple text input, you might consider using a wysiwyg editor like Trix, from Basecamp: https://github.com/basecamp/trix.

Also, when showing the data on your page, you can use the non escaping syntax for Blade:

{!! $content !!}.

Simply doing {{ $content }} will return <h1>Title</h1> where as using the non escaping syntax, you'll get the formatted html

10th August, 2018

wilburpowery left a reply on Calender • 1 week ago

Why not use a library like Full Calendar? https://fullcalendar.io/

wilburpowery left a reply on Trigger Notification On Bulk Insert • 1 week ago

Doing ModelName::create($array-of-data) will fire the event I'm pretty sure.

And to use the ->notify method on each appointment, you would need to be using the Notifiable trait.

9th August, 2018

wilburpowery left a reply on Laravel Search Delete • 1 week ago

You don't have the route pointing to the destroy method...

wilburpowery left a reply on Trigger Notification On Bulk Insert • 1 week ago

Yeah.

You can use Eloquent Events. For example, in your model you can have the following:

public static function boot()
{
    parent::boot();
    
    static::created(function ($appointment) {
        event(new AppointmentCreated($appointment));
    })
}

See the docs for Eloquent events here:

https://laravel.com/docs/5.6/eloquent#events

wilburpowery left a reply on Laravel:dusk Is Very Slow • 1 week ago

I think Laravel Dusk is simply a bit slow.

Some poeple find the Browserkit Testing package that was present in version 5.3 is still completely usable these days, you might find it's the right tool for you.

https://github.com/laravel/browser-kit-testing

wilburpowery left a reply on Does Laravel Require Itself And Composer To Be "installed" On A VPS Host? • 1 week ago

Honestly composer removes the necessity to be moving the vendor code of your application. Moving over that vendor folder which is very big, can sometimes take a ver long time.

8th August, 2018

wilburpowery left a reply on LARAVEL: AJAX Request Dont Set Session Variable • 1 week ago

Try using the Session facade instead of doing $requets->session().

wilburpowery left a reply on ExampleComponent.vue: Issue Just White Block Of Code • 1 week ago

Do you see any errors in your console about this?

wilburpowery left a reply on Laravel Valet Commands - Cheat Sheet ? • 1 week ago

No problem at all. Glad to help out.

wilburpowery left a reply on Notification Using Ajax. • 1 week ago

You can maybe have an interval function that does an AJAX call every couple of minutes and fetches all notifications.

But honestly I'd go with Echo for this kind of behavior.

wilburpowery left a reply on Laravel Valet Commands - Cheat Sheet ? • 1 week ago

Simply type valet in your terminal and you can see a list of all the commands.

![https://user-images.githubusercontent.com/15817188/43861118-1da79f1c-9b13-11e8-9938-4e233657080d.png]

wilburpowery left a reply on FullCalendar Vue JS Assigning Response To Variable • 1 week ago

Try using the arrow syntax to define your function, this way the this keyword will still represent the Vue instance.

success: (response) => {}

wilburpowery left a reply on Best Way To Update Lot Of Entries • 1 week ago

I'd leverage a Job for this. That way it will run in the background and not force the user to wait until the action is finished to load the view.

Also you might consider chunking the results in groups of 500 or so, just to be sure you don't run out of memory at any point. See https://laravel.com/docs/5.6/queries#chunking-results for more info.

You might also want to leverage a database transaction here. This is in case at any point anything fails, it will just undo all the queries it has performed previously. See https://laravel.com/docs/5.6/database#database-transactions for more info.

30th July, 2018

wilburpowery left a reply on Call Method Inside Component From App.vue (with Vue-routes) • 3 weeks ago

Maybe use a global event bus?

window.Events = new Vue();

then anywhere in your app you simply window.Events.$emit('my-event') and window.event.$on('my-event');

5th July, 2018

wilburpowery left a reply on Redirect User To Same Page After Making Them Login ( Laravel 5.6 ) • 1 month ago

Laravel's default login does exactly that for you. The users needs to visit a protected page that will redirect him to the login route. After that, using the redirect()->intended() will do what you want.

11th June, 2018

wilburpowery left a reply on Mail - Cannot Send A Message, No Errors • 2 months ago

Try calling Mail::fake() above the Log call.

8th June, 2018

wilburpowery left a reply on Do You Need To Pass 'Request $request' From Controller To Model? • 2 months ago

If what you're looking to do is create a new Product in the database, you should do something like this:

$validatedData = $request->validate([
        'name' => 'required|min:2',
     ]);

$product = Product::create($validatedData);

The create method is provided by the base Model class you extend in each of your models.

7th June, 2018

wilburpowery left a reply on Form Route Is Not Defined • 2 months ago

The resource method only registers the Restful routes.

INDEX, CREATE, STORE, SHOW, UPDATE, DELETE.

You need to register that rateUser route yourself.

24th May, 2018

wilburpowery left a reply on How Can I Execute My Own .exe (Windows) And Get Output Into Laravel • 2 months ago

A job sounds fine for me really. If the basic idea behind it is creating and manipulating a file, Laravel uses the Flysytem package. It's really awesome.

wilburpowery left a reply on How To Make Ajax Request • 2 months ago

You'll use Axios do make ajax calls to a given route. That route will be mapped in your backend to a given controller. The controller will do whatever it needs to do and return some data that will be available in the `.then() method. Are you a subscribed user on Laracasts? Jeffrey has a lot of videos where you can learn more stuff about this.

21st May, 2018

wilburpowery left a reply on Service Provider Routes Always Get 404, Even Though Exist In Route:list • 3 months ago

Does it still show up when running php artisan route:list?

wilburpowery left a reply on Got Error While Populating Database With Factory Method • 3 months ago

When you call the save method it expects it to be from an Model instance.

You should use create instead since you want to pass an array of data.

factory(App\Company::class, 10)->create()->each(function($u) {
        $u->users()->create(factory(App\User::class)->make(['company_id'=>$u->id, 'email'=> $u->email]));
    })->each(function($u){
        $u->dealers()->create(factory(App\Dealer::class,5)->make(['company_id'=>$u->id]));
    })->each(function($u){
        $u->programs()->create(factory(App\Program::class,5)->make(['company_id'=>$u->id]));
    });

Please take a look at this section of the docs to get a good grasp of the subject.

https://laravel.com/docs/5.6/eloquent#inserting-and-updating-models

18th May, 2018

wilburpowery left a reply on How Can I Send An SMS To Mobile With Laravel 5.6 On Localhost? • 3 months ago

Are you passing your values from nexmo in theenv() function? You shouldn't do that.

ENV files are to store credentials in a KEY-VALUE manner. For example for Nexmo, you would have something like this:

NEXMO_KEY=my_key NEXMO_SECRET=nexmo_secret

And then from you config/services.php file:

'nexmo' => [ 'key' => env('NEXMO_KEY'), 'secret' => env('NEXMO_SECRET'), 'sms_from' => '018xxxxxxxx', ],

What you pass inside the env() function should be the name of the key you want to fetch from the env file.

Also, check your storage/logs/laravel.log file to see what errors are happening.

17th May, 2018

wilburpowery left a reply on Can I Make REST Api And Use It On Route Web ? • 3 months ago

Are you using Laravel Passport?

If yes, there's a middleware you can include on your web group to consume your api from the frontend.

wilburpowery left a reply on Route - Why A String "[email protected]" And Not A Callback Controller::method() Or Similar? • 3 months ago

Also, Laravel loads all the controllers from the Container, so It woduln't be right to pass an instance of the Controller yourself.

wilburpowery left a reply on Route - Why A String "[email protected]" And Not A Callback Controller::method() Or Similar? • 3 months ago

Callbacks can't be serialized.

If you use callbacks in your route file you won't be able to cache it. Caching your routes will eventually make it faster so, yes. It's faster.

wilburpowery left a reply on Storage::put Vs Storage::putFile* • 3 months ago

Let's take a look at the source code.

public function put($path, $contents, $lock = false)
{
     return file_put_contents($path, $contents, $lock ? LOCK_EX : 0);
}
/**
 * Store the uploaded file on the disk.
 *
 * @param  string  $path
 * @param  \Illuminate\Http\File|\Illuminate\Http\UploadedFile  $file
 * @param  array  $options
 * @return string|false
 */
public function putFile($path, $file, $options = [])
 {
     return $this->putFileAs($path, $file, $file->hashName(), $options);
 }

put does indeed only use file_put_contents. `putFile on the other hand is used to save on the disk a file that has been uploaded (Http Request).

wilburpowery left a reply on Laravel Passport Series • 3 months ago

Taylor already created a video for Passport. Have you seen it?

https://laracasts.com/series/whats-new-in-laravel-5-3/episodes/13

wilburpowery left a reply on Authentication - Logs In At The Second Time • 3 months ago


if (Auth::attempt(['email' => $request->email, 'password' => $request->password, 'active' => 1], true)) {
            $user = Auth::loginUsingId($user->id, true);
}

The `attempt` method logs the user in if the credentials are valid. And then you're login in the user again using `loginUsingId`. I'm guessing the problem might come from this.

Try removing the `$user = Auth::loginUsingId($user->id, true);`.

wilburpowery left a reply on Array Pass In Modal Using Jquery • 3 months ago

I always recommend to give Vue.js a try. It makes all of this easy.

Jeffrey has a free series on Vue.js here: https://laracasts.com/series/learn-vue-2-step-by-step

wilburpowery left a reply on Regarding Group • 3 months ago

You can check the Laravel.io Slack channel.

wilburpowery left a reply on Array Of Policies As A Collection • 3 months ago

Why don't you take a look at the Bouncer package? https://github.com/JosephSilber/bouncer

14th May, 2018

wilburpowery left a reply on Best Way To View A PDF File In A New Tab • 3 months ago

You might want to take a look at file download responses.

https://laravel.com/docs/5.6/responses#file-downloads

wilburpowery left a reply on Counter With JS/Laravel • 3 months ago

I think this is a great time to introduce Vue.js to yourself.

https://laracasts.com/series/learn-vue-2-step-by-step

3rd May, 2018

wilburpowery left a reply on Access Component Vm Inside Of Non-arrow Function • 3 months ago

let vm = this; right after defining the graphOptions computed property? That way you could do something like this:

 positioner: function () {
   vm.positionTooltip(this.now)
 },

wilburpowery left a reply on Vue Why Props And Data Use Same Syntax As This.test? • 3 months ago

I'm really not sure about this. I'm guessing it first looks in the data properties for it, if it doesn't find it, it looks for it on the props object. If it isn't anywhere, it throws an error.

I'd love to get more info on this myself.

wilburpowery left a reply on How To Create A Link In Javascript With Laravel • 3 months ago

let tag = document.createElement('a');
tag.setAttribute('href', 'https://google.com');

Is that what you're looking for?

wilburpowery left a reply on Getting Last Inserted ID With Laravel Ask Question • 3 months ago

Can we see your migration file? Make sure you have the notification_template_id column as a increments().

13th April, 2018

wilburpowery left a reply on Better Way To Submit Json Data In Post Test • 4 months ago

$this->getJson() and $this->postJson()?

Are you using Laravel? We need a little more info about what you're using. :)

wilburpowery left a reply on How To Deal Invalid Urls In Laravel 5.5/vue.js2.5 Application ? • 4 months ago

You mean 404 routes? Laravel takes care of those for you by default. Or are you building an SPA?

wilburpowery left a reply on Route Validation • 4 months ago

I wouldn't create a new middleware for simply doing that check. I'd do it directly in the controller method.

You can do something like this:

abort_if(auth()->user()->id != $client->user_id).

If you use something like Policies it can be even better, you'd be able to refactor to something like this:

abort_if($user->can('view', $client))

wilburpowery left a reply on Route Validation • 4 months ago

I wouldn't create a new middleware for simply doing that check. I'd do it directly in the controller method.

You can do something like this:

abort_if(auth()->user()->id != $client->user_id).

If you use something like Policies it can be even better, you'd be able to refactor to something like this:

abort_if($user->can('view', $client))

wilburpowery left a reply on Nested Foreach/GroupBy - Laravel Decorators? • 4 months ago

I'f theres only a few groupBy clauses, I generally just chained them like the example from @bobbybouwmann. It helps to keep it very simple sometimes. :)

14th March, 2018

Edit Your Profile
Update

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