Talinon

Talinon

Member Since 4 Years Ago

Toronto

Experience Points
221,890
Total
Experience

3,110 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
1055
Lessons
Completed
Best Reply Awards
184
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 45
221,890 XP
Sep
19
2 days ago
Activity icon

Awarded Best Reply on Outlook Calendar APi Issue In Laravel

@jahanzeb786

Navigate to: Azure Active Directory -> Roles and administrators

You can expand the roles to see who you need to contact to grant the permissions. You'll need either a Global, Application or Clould Application Administrator to grant the permission changes.

Sep
18
3 days ago
Activity icon

Replied to Outlook Calendar APi Issue In Laravel

@jahanzeb786

Navigate to: Azure Active Directory -> Roles and administrators

You can expand the roles to see who you need to contact to grant the permissions. You'll need either a Global, Application or Clould Application Administrator to grant the permission changes.

Sep
17
4 days ago
Activity icon

Replied to Outlook Calendar APi Issue In Laravel

@jahanzeb786 Within Azure Portal, go to "App Registration" and create your app, if you haven't done so already. Once created, you can get your client id and the tenant id. You'll also need to add a client secret in which your app will use to authenticate.

With your app registered, you'll find a "API Permissions" button under the App Registration where you'll be able to request various access permissions for your app, including the Calendar. If you want your app to have access to all mailbox calendar accounts, you'll need the Microsoft Graph Calendars.Read Application rights. If you want to be able to modify, you'll need the Calendars.ReadWrite permission. You'll then need to get an administrator to grant the permission changes.

Once all the above has been set up, you should be able to perform your requests.

Sep
14
1 week ago
Activity icon

Awarded Best Reply on Upgrade From 6 To 7 Failed

@fbc See my comment above. You basically need to change the typehint in your hander.php from Exception to Throwable

You can see an example here:

https://github.com/laravel/laravel/blob/7.x/app/Exceptions/Handler.php

Activity icon

Replied to Argument 1 Passed To Illuminate\Database\Eloquent\Builder::update() Must Be Of The Type Array,

@hendrasaputra2323

This is what you need.. you need to pass in a variable, instead you are passing in the string of the variable's name.

 Tags::whereId($id)->update($tags_data);
Activity icon

Replied to Upgrade From 6 To 7 Failed

@fbc See my comment above. You basically need to change the typehint in your hander.php from Exception to Throwable

You can see an example here:

https://github.com/laravel/laravel/blob/7.x/app/Exceptions/Handler.php

Activity icon

Replied to Upgrade From 6 To 7 Failed

@fbc You'll want to check out the upgrade guide, especially this section which will explain:

https://laravel.com/docs/7.x/upgrade#symfony-5-related-upgrades

Activity icon

Replied to Lumen Or Laravel For API Development?

@cwray-tech It's possible to install a package thru composer to bring RMB into Lumen. You are also correct in observing that Lumen does not nearly get as much love (updates) or support as Laravel.

One of the main reasons why you would consider Lumen is if you are very concerned over speed, or workload due to high traffic. High traffic is subjective and depends on many factors, but if you're not expecting the app to handle a huge amount of requests, or requests that require complex calculations, you most likely want to just stick with Laravel.

Aug
14
1 month ago
Activity icon

Awarded Best Reply on Why I Make Test To My Projects ?

@mahmoud_ayad Just to add to the answers: If you provide descriptive test function names, your test suite gives the extra bonus of reading as documentation - either to remind yourself in 2 years down the road, or any other developer that may come along to contribute to the project.

any_registered_user_may_like_a_forum_thread_reply() is clear what features your app provides, and if you break something that causes this test to fail, you have immediate feedback on exactly what feature is not behaving as expected.

It also allows you to refactor with confidence. Think of a better way to write something? Great, make the changes, then run the test suite to make sure you didn't inadvertently break something else. How else would you have done it without tests? Manually test everything in the browser and hope you didn't forget about every feature that depends on that unit of code.

Activity icon

Awarded Best Reply on Job Sent To Queue Behave Differently With Eloquent

@romain make sure you are restarting your queue workers after each change to the code. Your long living horizon process might have an earlier version running in memory.

Aug
13
1 month ago
Activity icon

Replied to Why I Make Test To My Projects ?

@mahmoud_ayad Just to add to the answers: If you provide descriptive test function names, your test suite gives the extra bonus of reading as documentation - either to remind yourself in 2 years down the road, or any other developer that may come along to contribute to the project.

any_registered_user_may_like_a_forum_thread_reply() is clear what features your app provides, and if you break something that causes this test to fail, you have immediate feedback on exactly what feature is not behaving as expected.

It also allows you to refactor with confidence. Think of a better way to write something? Great, make the changes, then run the test suite to make sure you didn't inadvertently break something else. How else would you have done it without tests? Manually test everything in the browser and hope you didn't forget about every feature that depends on that unit of code.

Activity icon

Replied to Job Sent To Queue Behave Differently With Eloquent

@romain make sure you are restarting your queue workers after each change to the code. Your long living horizon process might have an earlier version running in memory.

Aug
07
1 month ago
Activity icon

Awarded Best Reply on Supervisor Is Doing The Same Job Several Times

maybe try adding a --timeout=60 and see what happens.. maybe its being too impatient and trying the job again before its finished. Or check the public property $timeout on your job, as according to the documentation that will take precedence.

Also check over your config/queue.php configuration.. make sure you don't have a low retry_after value

Aug
05
1 month ago
Activity icon

Replied to Learning Laravel

@zintapritie2 You mentioned you liked to learn by video - well, you're in the right place.

Start off with this series:

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

It's free, and will cover everything you need to know to get started, demonstrated by a professional in the community.

Activity icon

Replied to Update Return False

@timtom It is considered polite to mark the person with the most helpful response as the best answer - not regurgitating what someone suggested and then marking yourself with the answer.

Activity icon

Replied to Is It A Good Idea To Put Models In Different Directories?

@martinzeltin If they are large features, you could consider using modules to organize all your classes. You don't really need a package to set it up, but it makes things easy:

https://github.com/nWidart/laravel-modules

But, I likely wouldn't reach for this unless you're developing something large enough to be considered an application in its own right.

Activity icon

Replied to Is It A Good Idea To Put Models In Different Directories?

@martinzeltin I don't see any problem with it. You are free to structure your models the way you think makes the most sense. There is absolutely no harm in doing this, other than having longer namespaces (who cares)

Personally, I'd place all my model sub-directories under a /app/models directory though.

Activity icon

Replied to Supervisor Is Doing The Same Job Several Times

maybe try adding a --timeout=60 and see what happens.. maybe its being too impatient and trying the job again before its finished. Or check the public property $timeout on your job, as according to the documentation that will take precedence.

Also check over your config/queue.php configuration.. make sure you don't have a low retry_after value

Activity icon

Replied to Update Return False

@timtom In older versions (< 5.2 I think) it used to return false if nothing was changed on the update.

Again, I can't really tell you much without more context.

Activity icon

Replied to Supervisor Is Doing The Same Job Several Times

@ramonribeiro96 Ok, it doesn't appear to be a case of failed retries.

Are you sure you're not dispatching the job twice within your code somewhere? Maybe you have a model event listener set up that is firing another job?

Also - is this a long running job?

Activity icon

Replied to Update Return False

@timtom Usually if it fails an exception will be thrown, which will have the details of the error. Is that not happening?

You could always try manually catching it to see what is going on:

try {

	$model->update();

} catch (\Exception $exception) {

	dd($exception->getMessage();

}
Activity icon

Replied to Service Container - Real World Example

@ravish I remember struggling wrapping my mind around this at first, too. There is a lot going on, perceivably by magic. Although, once you understand it, it's quite simple.

I just read every blog/video I could find on it.. then went back to the manual and read it until it made sense. Playing around with a pet project also helped to hammer home the concepts.

Here are some resources that may help:

https://m.dotdev.co/understanding-laravel-service-container-bd488ca05280

https://stackoverflow.com/questions/37038830/what-is-the-concept-of-service-container-in-laravel

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

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

Then go back and read this entire manual, and hopefully it will make more sense:

https://laravel.com/docs/7.x/container

Activity icon

Replied to Update Return False

@timtom You're going to need to do a better job explaining what you're trying to do.

Show some code.

Activity icon

Replied to Migrating An Old Project To Latest

@yeasir_arafat I'm not sure I'm following. Why would you maintain 2 code bases?

You have revision control, right?

Make a new branch, update your composer.json to pull in the newer version of the laravel framework, and follow the upgrade guide.

I highly suggest to upgrade your code base one version at a time. Hopefully you used a TDD approach, where you can then test your application at each version.

You may also want to look into Laravel Shift: https://laravelshift.com/

Once you have your development code base upgraded, then you can push it to production, and then start your new features.

Activity icon

Replied to Supervisor Is Doing The Same Job Several Times

@ramonribeiro96 What makes you think it is running the same process simultaneously?

Are you certain the job isn't failing at some point, and its just the additional retry attempts? The fact you say 3 times makes me suspect this might be the case, as that is the default.

Check your log files for errors.

Aug
03
1 month ago
Activity icon

Awarded Best Reply on Displaying An Array

@dmcglone27 The test you created is an array of strings. Each entity wrapped in quotes in your array is a string

The result you're getting from the youtube package is an array of objects

An object is a much more complex entity than a string, and is way beyond the scope of this thread. You should do some reading up on PHP objects.

But, to get you on the right path, the snippet you provided for the dd($videoList) shows an array containing 4 objects. Notice how each index starts with a {#num -- this tells you it's an object.

You can see the public property names and values of each object. kind is a property name and youtube#searchResult is its value.

So, you can echo out one of the properties by doing:

@foreach($videoList as $video) {
           {{ $video->kind }}
@endforeach

Likewise, snippet is another object within an object. So if you wanted to echo out that data, you could probably use: {{ $video->snippet->description }}

Remember, -> is an object operator which can only be used on objects. This will fail on arrays or strings. When you see documentation use -> that is a clear indication you're dealing with an object.

Aug
02
1 month ago
Activity icon

Awarded Best Reply on Production.ERROR: The Separation Symbol Could Not Be Found

@noblemfd is the hire_date set to null?

Carbon will parse null to default system date.

You could do a check for that in your accessor method:

public function getHireDateAttribute($value)
{
    return is_null($value) ? "Unknown" : Carbon::parse($value)->format(config('app.date_format'));
}    
Jul
31
1 month ago
Activity icon

Awarded Best Reply on Router - Is It Possible To Stop Sending Route Parameter To Controller Action

@Čamo Understood.

Well, you could create middleware that would remove it:

public function handle($request, Closure $next)
{
	$request->route()->forgetParameter('locale');

        return $next($request);
}

I think that would work.. then the first argument of your controller methods would be bound to {book}

You'd just have to make a route group that applies the middleware to all routes.

Activity icon

Replied to Router - Is It Possible To Stop Sending Route Parameter To Controller Action

@Čamo Understood.

Well, you could create middleware that would remove it:

public function handle($request, Closure $next)
{
	$request->route()->forgetParameter('locale');

        return $next($request);
}

I think that would work.. then the first argument of your controller methods would be bound to {book}

You'd just have to make a route group that applies the middleware to all routes.

Activity icon

Replied to Router - Is It Possible To Stop Sending Route Parameter To Controller Action

@Čamo So, you are basically just trying to shorten the detail() method signature to avoid having 2 parameters? Is it really that big of a deal to just include the first parameter?

One way you could go about it would be to register a model binding in a service provider.

Route::model('book', \App\Book::class);

Then you could actually have an empty method on your controller and use a helper function:

public function detail() 
	{
		return view('book.detail', [
			'book' => request('book'),
		]);
	}

I don't think I'd personal go about it in this way though.. I rather just use the build-in route model binding and just live with having 2 method arguments.

Jul
30
1 month ago
Activity icon

Replied to Displaying An Array

@dmcglone27 The test you created is an array of strings. Each entity wrapped in quotes in your array is a string

The result you're getting from the youtube package is an array of objects

An object is a much more complex entity than a string, and is way beyond the scope of this thread. You should do some reading up on PHP objects.

But, to get you on the right path, the snippet you provided for the dd($videoList) shows an array containing 4 objects. Notice how each index starts with a {#num -- this tells you it's an object.

You can see the public property names and values of each object. kind is a property name and youtube#searchResult is its value.

So, you can echo out one of the properties by doing:

@foreach($videoList as $video) {
           {{ $video->kind }}
@endforeach

Likewise, snippet is another object within an object. So if you wanted to echo out that data, you could probably use: {{ $video->snippet->description }}

Remember, -> is an object operator which can only be used on objects. This will fail on arrays or strings. When you see documentation use -> that is a clear indication you're dealing with an object.

Activity icon

Replied to Displaying An Array

@dmcglone27 Youtube::listChannelVideos() must be returning an array of objects. You are getting that error because you're trying to export each object as string.

Check the documentation for getter methods for each video. Probably need to do something like {{ $video->getId() }}

Or perhaps you can access public properties directly.. try dumping $videoList[0] and see what you're working with.

Activity icon

Replied to Production.ERROR: The Separation Symbol Could Not Be Found

@noblemfd is the hire_date set to null?

Carbon will parse null to default system date.

You could do a check for that in your accessor method:

public function getHireDateAttribute($value)
{
    return is_null($value) ? "Unknown" : Carbon::parse($value)->format(config('app.date_format'));
}    
Activity icon

Replied to Production.ERROR: The Separation Symbol Could Not Be Found

@noblemfd do you have a hire_date field in your database table?

If not, your accessor will use null for $value, which Carbon will parse into the current date.

Activity icon

Replied to Production.ERROR: The Separation Symbol Could Not Be Found

@noblemfd

The Trailing data portion of the error will be because of your use of createFromFormat().

You could correct it by instead doing this:

return Carbon::createFromFormat('Y-m-d H:i:s', $input)
      ->format(config('app.date_format'));

But, I think you're over engineering all this. From the looks of it, you just want a basic accessor for your view, right?

public function getHireDateAttribute($value)
{
    return Carbon::parse($value)->format(config('app.date_format'));
}    

Then within your view:

	{{ $employee->hire_date }}
Jul
29
1 month ago
Activity icon

Replied to VueJS Mutiple File Uploads

@varovas I would give filepond a try as it has asynchronous file uploads, a nice UI, and a Vue adapter.

Jul
28
1 month ago
Activity icon

Replied to Go Through Config() Secondary Database Connection

@danven You can't have an expression when defining a class property, it needs to be a constant value so it can be evaluated at compile time.

You should be able to do this:

class MyModel extends Model
{
   
   public function __construct(Array $attributes = [])
    {
    
        parent::__construct($attributes);

        $this->setConnection(config('database.secondary'));
    
    }

}

Activity icon

Replied to VueJS Mutiple File Uploads

@varovas May I ask why you require to make a separate request for each file?

I can't think of any reason why you would want to do this when you could just iterate over the array of files and perform whatever individual operation is required per file.

But, a quick short answer is: yes, it's possible.. you could use a promise-based approach where each file is uploaded one after the other.

Jun
26
2 months ago
Activity icon

Replied to Unable To Connect Log Into MySQL

@gurinder121

Try: mysql -uroot -p

Activity icon

Replied to [Vue Warn]: Cannot Find Element: Vue-app

@nickywan123

I see absolutely nothing wrong with what you have. I pasted exactly what you have above and it works fine.

Activity icon

Replied to Use Slice On Javascript Object To Loop For All Elements Except First Two?

@gabotronix

If you know what the first two property names are called, you can do something like this:


Object.keys(myObject).forEach(function(key,index) {

    if (key == 'first' || key == 'second') return;

	// do whatever
});     

Otherwise:

Object.keys(myObject).forEach(function(key,index) {

    if (index < 2) return;

	// do whatever
});     

May
24
3 months ago
Activity icon

Awarded Best Reply on Call To Undefined Function GetUser() After Deploy On Heroku Serve

@spiral You have the helper defined under autoload-dev, so of course it won't work on production.

Activity icon

Awarded Best Reply on Seeing Puzzling And Inconsistent Results With Unit Test

@connecteev I think your other methods worked because you were creating a model then asserting against it. With the update method, you already had an instance of a model, then applied an update to a related piece of data, then asserted against the original instance without the changes. Using refresh() will reload the model, along with it's relationships (which would include the changes you made via the PUT request)

It's not necessarily any bad practice on your behalf, it's just something to be aware of. You will require to refresh your model from time to time with unit testing to make a test pass. It's one of the reasons why the refresh() method was included within the framework. Alternatively, if you don't want to refresh the model, you could always assert against the database.

Activity icon

Replied to Seeing Puzzling And Inconsistent Results With Unit Test

@connecteev I think your other methods worked because you were creating a model then asserting against it. With the update method, you already had an instance of a model, then applied an update to a related piece of data, then asserted against the original instance without the changes. Using refresh() will reload the model, along with it's relationships (which would include the changes you made via the PUT request)

It's not necessarily any bad practice on your behalf, it's just something to be aware of. You will require to refresh your model from time to time with unit testing to make a test pass. It's one of the reasons why the refresh() method was included within the framework. Alternatively, if you don't want to refresh the model, you could always assert against the database.

Activity icon

Replied to Laravel Prefix Route Not Found

@adeguntoro check the output of php artisan route:list for clues

Activity icon

Replied to Controller Input Validation Help

@mitchmoon:

If your select element is holding string values: required|string|min:1|max:30

Activity icon

Replied to Seeing Puzzling And Inconsistent Results With Unit Test

@connecteev Oh I see, I was just a bit confused by the way you had the code snippet.

Hmm.. have you tried refreshing the model?

$isUserSubscribed = $user->refresh()->subscribed(env('STRIPE_SUBSCRIPTION_PRODUCT_NAME'));
Activity icon

Replied to Seeing Puzzling And Inconsistent Results With Unit Test

@connecteev

Shouldn't your endpoint being using $loggedInUser and not $user?

 $loggedinUser = auth()->user();
        $loggedinUser->newSubscription(env('STRIPE_SUBSCRIPTION_PRODUCT_NAME'), $stripePlanId)->create($paymentMethodId);

// below you have $user, not $loggedInUser
$isUserSubscribed = $user->subscribed(env('STRIPE_SUBSCRIPTION_PRODUCT_NAME'));

Also, FYI, it is best practice to use config() over env() within your code. That way, you can cache your configuration - otherwise, everytime your application calls env() it's going to read to the disk, which is very slow.

Activity icon

Replied to Call To Undefined Function GetUser() After Deploy On Heroku Serve

@spiral You have the helper defined under autoload-dev, so of course it won't work on production.

Activity icon

Replied to Laravel UpdateOrcreate Missing Value

@artyak Looks to me like you have them reversed.. check out the end of my edited response above