Member Since 3 Years Ago

Experience Points 63,780
Experience Level 13

1,220 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 586
Best Reply Awards 7
Best Reply
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement


    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement


    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

11 Feb
3 months ago

andreasbakir left a reply on Please Help Me Pick A Front End!

this is my opinion based on my experience with vuejs and react.

I would say definitely VueJS! I worked allot with React. I hate JSX it's horrible using html in a js file makes no sense. VueJS has two-way datamodel binding which is (in my opinion) a delight to work with! Single File Components are well structured.

andreasbakir left a reply on How To Convert Big Name To Short

$name = 'Ram Kumar Vermar';

    if(strlen($name) < 16) {
        return $name;
    $nameArr = explode(' ', $name);

    return substr($nameArr[0], 0, 1) . '.' . substr($nameArr[1], 0, 1) . ' ' . $nameArr[2];

this should work using @vilfago suggestion.

08 Feb
3 months ago

andreasbakir left a reply on How To Get All Children Recursively?

@KNUBBE82 - so it's actually a formatting problem? You could do a couple of things, override the toArray or toJson method on your eloquent model, or the more elegant way use an eloquent-resource (

30 Dec
4 months ago

andreasbakir left a reply on Add A '-' To Input When Reach Certain Input Length

you need a "input mask" this is a neat little plugin I use myself often

14 Dec
5 months ago

andreasbakir left a reply on Vue, Dynamic Input Field, Retain/Keep After Refresh

Do the form validation by Ajax request and not in a traditional request!

10 Dec
5 months ago

andreasbakir left a reply on Scheduled Artisan Task Not Executing Properly

For whom it may concern I fixed it.

Apparently calling external binaries from the php "exec" function won't work if you don't specify the whole path of that binary (it has a different scope I guess). So I changed this line:

exec("ffmpeg -i {$filename} -vcodec copy -acodec copy -ss 00:00:00 -t {$duration} trimmed-{$filename}");


exec("/usr/local/bin/ffmpeg -i {$filename} -c copy -t {$duration} trimmed-{$filename} -nostdin -nostats </dev/null >/dev/null 2>&1 &");

as you may notice I also added the following:

</dev/null >/dev/null 2>&1 &

to make sure the process will run in the background and outputs nothing so that the exec function won't wait for some output.

@talinon thanks anyway! But it had nothing to do with permissions :)

andreasbakir left a reply on Scheduled Artisan Task Not Executing Properly

@TALINON - hmm makes a bit sense but this is Laravel valet we are talking about.. Or doesn't that matter? If not could you point me in the right way, what should I check? Which permissions should I change? Thanks in Advance!

andreasbakir left a reply on Scheduled Artisan Task Not Executing Properly

someone having an idea..?

09 Dec
5 months ago

andreasbakir started a new conversation Scheduled Artisan Task Not Executing Properly

Hi All,

I am building a web app which downloads m3u8 files. The m3u8 files should be concatenated into a mp4 file. This works all well and fine. Unfortunately a HLS m3u8 stream consists of multiple .ts video files, so when you click the "stop record" button. You will get a video file which is slightly long than the user intended to.

So I made an artisan command, which checks whether the video should be trimmed or not by calculating the time difference between pressing the start and stop record button and the actual video length.

The artisan command, get's triggered by my scheduler (I checked it by logging the arguments, and some random stuff in the command) but the video won't get trimmed!

Now the strange part, when I execute the artisan command manually the video DOES get trimmed. Even more strange when I make a route which executes the same artisan command, it once again trims the video as it should.

So my problem is: the artisan get's triggered by my scheduled cron job, but the video is not being trimmed, while doing it manually or by a temporary test route it all works.

here is my command:

public function handle()
        $conversion = Conversion::whereFilename($this->argument('filename'))->firstOrFail();
        $filename   = $this->argument('filename');

        $from  = Carbon::createFromTimestamp($conversion->from);
        $until = Carbon::createFromTimestamp($conversion->until);
        $duration = $until->diff($from)->format('%H:%I:%S');
        exec("ffmpeg -i {$filename} -vcodec copy -acodec copy -ss 00:00:00 -t {$duration} trimmed-{$filename}");
        $conversion->update(['trimmed' => true]);

What the hells is going on...?

11 Nov
6 months ago

andreasbakir left a reply on Array Flatten

@INSPIREDPRYNCE - That's strange can you give me an example of what you are trying to do, what the result is that you are expecting and what you actually get when you use my function ?

19 Sep
8 months ago

andreasbakir left a reply on Is VUE JS Protected Against Changing Price Values In Webshop?

@D9705996 it's actually more of a confirmation but no problem :)

andreasbakir left a reply on Is VUE JS Protected Against Changing Price Values In Webshop?

@D9705996 that's exactly what I thought! As a programmer we shouldn't trust any user haha.

andreasbakir started a new conversation Is VUE JS Protected Against Changing Price Values In Webshop?

Hi all,

I was just wondering, if vue js has any protection against f.e someone opening the vue-dev tools on a webshop and changing the price of a product?

I know that when you compile down vue js in laravel mix with npm run production the vue dev tools won't be available. But isn't it possible for someone to inject the needed code for vue dev tools anyway?

In that case it would be possible for the attacker to change a products price. Do I have to somehow protect something like this from the backend side? Or is it impossible for an attacker to change my vue variables once it's build for production?

14 Sep
8 months ago

andreasbakir left a reply on Array Flatten

@Cronix the flatten method on a collection resets the array_keys of the array.

@wilk_randall And that is the exact reason why I made that little function, I do prefer using laravel helper methods over creating your own methods, but if you don't get the result you wish for you should make up your own solution.

13 Sep
8 months ago

andreasbakir left a reply on Nova, Backpack Or Another?

Build your own one yourself... Believe me it's better! There are no one fits all solution out there, I have searched for it for a while. The good ones you would have to pay for and they only give you a starter package with the commonly used stuff. But if you need something specific you would still have to build it yourself.

So I decided to build it myself, I have build my own admin-panel (it's actually a cms) with larval + vue js. I have made use of Vuetify for the frontend building blocks, but Element UI might have been a better choice. I like the simple ui of element ui more than material design.

andreasbakir left a reply on Array Flatten

I wrote this code for you, I tested it and it works.

Route::get('/', function () {
    $myArray = [
        ['3101625668' => 98.0],
        ['3913126364' => 35.77],
        ['3913058204' => 25.33],
        ['3101372540' => 33.47],
        ['3913752741' => 40.0],
        ['3913120054' => 20.4],
        ['3913998755' => 26.8],
        ['3913861492' => 25.2]
    $sanitizedArray = sanitizeArray($myArray);
    return $sanitizedArray;

function sanitizeArray($array)
    static $newArray = [];
    foreach ($array as $key => $value) {
        if(is_array($value)) {
        } else {
            $newArray[$key] = $value;
    return $newArray;
12 Sep
8 months ago

andreasbakir left a reply on Crop Image Before Uploading To S3

first of all you will need to upload the image with AJAX. You will need to crop the image before sending it to the server, there are many crop tools (some great ones for vue js). Uploading images with Ajax is explained I believe in the "lets build a forum" series. So start watching that first.

03 Sep
8 months ago

andreasbakir left a reply on How To Model Thumbnails?

you should definitely check out this package!

I use it for a similar use case, it is great!

30 Aug
8 months ago

andreasbakir left a reply on Axios POST Multipart Formdata Object Attribute

@MikeMacDowell thank you, I fixed it already! I came up with the same solution as you suggested but I have used this little utility npm package it converts nested json objects to formdata!

28 Aug
8 months ago

andreasbakir started a new conversation Axios POST Multipart Formdata Object Attribute


I have a model (Node) which can have different kind of values (pretty dynamic). So a node could have a textfield, raw html, but it can also contain images. I build the validation rules depending on what get's posted.

Posting some text or raw html works fine, but as soon as I try to post an image (or multiple images) stuff breaks... This has to do of course with incorrect headers, the images need to be posted as formdata but the images are nested in the root node object. For a better understanding and visualization check my object down below.

let node = {
    title: 'Title of the node',
    body: '<h1>Some body tekst</h1>',
    slug: 'title-of-the-node',
    meta_title: 'Custom title for seo',
    meta_description: 'Custom description for seo',
    fields: {
        images: formData() // a filled out formData object

When I post with axios like this:'/some-end-point', node.fields.images);

Everything works fine, but when I post the main node object like this:'/some-end-point', node);

In this case the server doesn't recognize the formData, when I dump the request it shows an empty array.

Is it possible to set headers for just the formData objects in the field object? Doing multiple requests would be a nightmare (so posting first separately the formData objects and than the other values). Since the fields object is dynamic, it could contain many images attributes or none. And everything has to be validated before it get's stored in the DB and by doing multiple requests it is a nightmare to check wether everything got validated and than post it again in the right order so that the images get attached to the newly created Node...

27 Aug
8 months ago

andreasbakir left a reply on Letsencrypt Not Working!

@Cronix not yet... I thought maybe the community encountered the same issue, if not I will definitely contact Forge support.

andreasbakir started a new conversation Letsencrypt Not Working!

Hi all,

So I have the following configuration: Laravel Forge with a Vultr VPS running Ubuntu 18.04

I have a subdomain pointing to the ip adress of the VPS, when I try to install a letsencrypt ssl certificate I get the following error:

--2018-08-27 08:41:12--
Resolving (,, 2400:cb00:2048:1::6819:820, ...
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘letsencrypt_script1535359272’

     0K ..                                                     24.1M=0s

2018-08-27 08:41:12 (24.1 MB/s) - ‘letsencrypt_script1535359272’ saved [2579]

debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin: 
Command "python egg_info" failed with error code 1 in /tmp/pip-build-nIDFVi/pycparser/

I googled it but couldn't find any solution to this problem? Has someone an idea or did someone encountered the samen problem, and if so how did you fixed it?

23 Aug
9 months ago

andreasbakir left a reply on Serverside Render VueJS - NO SPA -

@Snapey you often come with great solutions! Do you have a clue? Or maybe @bobbybouwmann as a fellow dutchman :) do you perhaps have an idea?

andreasbakir left a reply on Serverside Render VueJS - NO SPA -

@Tomi I already looked into both links... they assume that you use the vue cli and only use JS for the content. In my case (and I believe this is probably the case with most laravel users) I use php and alongside with that to make the experience more smooth I use Vue.

andreasbakir started a new conversation Serverside Render VueJS - NO SPA -

Hi All,

I am working on a website for a client, and I have used some custom made vue components that I can reuse in the website. F.e I have build a custom input field, which automagically handles Ajax requests and display the corresponding errors (if any).

The webpage consists of mixed content, what I mean with "mixed content" is, that I use some globally declared vue components, some inline vue components and just regular html5.

The site is definitely not a SPA, nor would it be easy to extract it into an SPA or even a MPA for that matter. I don't use vue-router, but I do use vuex. So the routing is done by full page refreshes and not handled client-side.

The problem I am facing at the moment, is that the source code of the pages contain the not rendered components.

I have an component <input-field name="laracasts" v-model=""></input-field>

When I look at the source of the page I see exactly that piece of code, I would like to see instead the rendered version of it for SEO purposes so in this case I would like to see the html5 elements which build op this "input-field"

I know about server side rendering which just recently have been made available for PHP, thanks to the v8js google engine. But in all the documentation and online guides/tutorials it is based on a VueJS application which has no PHP whatsoever in it's templates, only .vue components can be used to achieve the SSR.

Is there a way to SSR my application with the "mixed content", or should I forget about it?

It is not for the performance, performance wise the site is great it's more for SEO, or shouldn't I be to concerned for SEO?

What are your thoughts, or perhaps some idea's? I thought about using headless chrome to render the page, and then return the HTML, but I think that's going to have a too big of a negative impact on the performance.

16 Jul
10 months ago

andreasbakir left a reply on Onchange Event, Getting A Value From A Select Tag And Changing The Visibility Of Other Elements

Show us what you have build so far. Do you expect us to write your code for you? Give some more information, are you using vue js or something else?

andreasbakir left a reply on How To Ensure A User Can Only Delete It's Records?

Depends on what restrictions you want to have for your users :) If it is something really really simple, you could add a "role" column to your User table and make a middleware to check if the user is authorized to perform an action. Otherwise go for gates/policies. Or use both :)

andreasbakir left a reply on Ford Endeavour VS Toyota Fortuner

Are you on the right forum?

15 Jul
10 months ago

andreasbakir left a reply on Sync Sqlite (offline) With Mysql (online) Database

I am just thinking out loud at the moment, would it be an idea to use sqlite on Laravel aswell instead of MySql? And broadcast somekind of event or something withing a queue and check whether the clients have the same database locally and if not it will sync up? I would probably need some kind of websockets for this I guess...

andreasbakir started a new conversation Sync Sqlite (offline) With Mysql (online) Database

Hi all,

I have a question, I am building an app for a client there is one requirement that is a MUST. And that is to be able to use the app completely offline. The app give the user the ability to fill in a form add some pictures/videos to it and save it (and store it in a sqlite db on the phone). As soon as the phone has a stable internet connection the data has to be pushed to the server (in this case to a laravel application which uses mysql as it's db).

I have looked in to firebase (firestore to be precise). And it provides exactly what I need, the down side is of using firestore. Is that I have to rebuild a part of my application and actually completely throw away what I have build in Laravel... I would rather not do that.

Furthermore there are going to be uploaded many pictures and videos, and firestore get's expensive when going this route. So I thought about uploading the pictures to a Laravel application and returning the path to this picture and storing that URL in to firestore. But than again I will be using, Laravel for storing asstes, firestore for storing data and the app (which is build in Flutter) stores it's data in sqlite.

It is a bit annoying to use so many services. So my question is, is there a possibility to not use Firestore, but keep my laravel backend as it is and tweak it a little (maybe install a package of some kind?) to be able to synchronize between the offline sqlite db and the online mysql db.

I can't believe I am the only one who encountered this issue but unfortunately I couldn't find anything on stackoverflow or google.

Thanks in advance for who is willing to think along with me to come up with a solution :)

@TaylorOtwell I don't know if this is the right place to do a request, but it would be really cool and would really boost the number of users of Laravel if something like db sync would be implemented in to the core (or a first party package) of laravel.

11 Jul
10 months ago

andreasbakir left a reply on Get Only Hours From Hours And Minutes

If you do allot of date manipulation or date formatting I would suggest using moment js. It is similar to carbon

andreasbakir left a reply on How To Refactor This Code?

@Snapey @Cronix @lostdreamer_nl wow you guys are awsome! Great Feedback! I think I will do what @lostdreamer_nl suggests. FYI the users are being eagerloaded so that's not another query.

But your example looks cleaner in my opinion! Thanks allot!

10 Jul
10 months ago

andreasbakir left a reply on Use Vuejs On Existing Laravel App

well depends on... You can still use the standard login forms and controllers you have by just submitting those forms without vue. All the other stuff you can convert to VueJS. But if you want to also do the authentication by VueJS. You should use Laravel Passport or this package (I prefer this package over Laravel Passport)

andreasbakir left a reply on How To Create Middle Ware And How To Use I Already Trying But Not Proper Work Just Error Show --

Could you show what code you wrote? And where you get stuck?

andreasbakir started a new conversation How To Refactor This Code?

Hi all!

For a customer I build a forum, the customer wants that for each reply in a discussion all the discussion contributors receive an email (similar to facebook). Of course if you reply to a discussion you shouldn't receive an email. You find my code below.

$link = env('APP_URL') . "/discussie/{$event->post->discussion->category->slug}/{$event->post->discussion->slug}";

    ->map(function ($post) {
        return $post->user;
    ->filter(function ($user) {
        return $user->email !== auth()->user()->email;
    ->map(function ($user) use ($link) {
        \Mail::to($user)->send(new NewResponse($user->name, $link));

Is this the cleanest way to do it? Or do you guys see a refactor in this code?

04 Jul
10 months ago

andreasbakir left a reply on Package Development, Can't Use Eloquent Model Methods

OMG I was struggling with this since yesterday and just as I typed out this question I thought about something. My model "Node" makes use of softdeletes. I added the "deleted_at" column as a string. This broke everything! So if someone encounters the same problem, check your Schema!

andreasbakir started a new conversation Package Development, Can't Use Eloquent Model Methods

Hi all,

First of all I am new to laravel package development. I am trying to build a package, but something isn't working right. In the following path: "package/src/Models" I store all my models. I have one f.e called "Node" it extends from Model (Illuminate\Database\Eloquent\Model). But whenever I try to do something like

$node = Node::find(1);

I get this exception:

Trying to get property of non-object (View: ~/Code/MyPackage/resources/views/index.blade.php)

I can't use standard eloquent methods/static methods. Am I doing something wrong? Or is it a limitation of package development to be not able to use standard laravel functionallity? If so, what is the right approach?

Thank you in advance!

27 Jun
10 months ago

andreasbakir left a reply on Want To Clean Up An If Statement

I would go for a completely different approach, I would make make a pivot table with a user_id and post_id (or whatever you named your model). You should add a record to this pivot table the moment a user leaves a review behind.

Then I would make a custom gate ( in the gate you build you should check if the authenticated userid exists in the pivot table and if it's corresponding post_id is the same as the current post_id, if so return false. And else return true. And depending on the returned value you can display different views!

I would do it this way, and IMHO this is a nice way, but there are definitely other ways to do it as well.

andreasbakir left a reply on Future Of PHP Laravel

@ccarver My most favorite framework is definitely Laravel! I use it daily and I hope to use it many more years. I fully agree with you, the Laravel community is just awesome, and Taylor is a mad genius.

The only thing that concerns me is the fact that NodeJS is faster than PHP. And the difference in performance is only getting bigger and bigger.

I am convinced that for now and in the near future that PHP is going nowhere. NodeJS still lacks allot of essential stuff IMHO, f.e an ORM which is as user-friendly as Eloquent and much more.

andreasbakir started a new conversation Future Of PHP Laravel

Hi all!

I was wondering whether PHP (And thus Laravel) has a positive future? Every year we see an increase of NodeJS applications in favor of PHP ( At the moment PHP is still the "big guy" for now...

It wouldn't shock me if in a couple of years NodeJS would dethrone PHP as the most used language/library for backend web development.

In my opinion PHP has to either release a new version with a performance gain of a couple of hundred percent, or it will eventually die out.

What are your thoughts about the future of PHP/Laravel?

And @JeffreyWay if in the case that PHP isn't that popular anymore, would you consider on teaching us other frameworks? F.e which is a NodeJS framework who is highly inspired by Laravel?

Please share your thoughts :)

09 May
1 year ago

andreasbakir started a new conversation Flex Vs CSS Grid

Hi Guys,

I was thinking about something, @JeffreyWay released a new serie "Modern CSS for Backend Developers". He teaches allot of cool things, but I was wondering, why CSS Flex? Why not CSS Grid? IMHO using CSS Grid results in a much cleaner HTML/DOM structure. I know that the support atm isn't that great (87%~, but 87% is still allot!

Or do you guys think that it is to early to use CSS Grid?

PS: Don't understand me wrong, I love Flexbox! I use it everyday, I would still use it in combination with CSS Grid for aligning stuff etc. But not for the general layout/grid it self.

07 Feb
1 year ago

andreasbakir left a reply on Updated Laravel But The Vendor Folder Is An Exception?

ssh in to your live server and do a composer install instead of composer update

andreasbakir left a reply on Impersonate User In SPA Application

try making a personal access token with the user_id you want to impersonate, it should work!

30 Jan
1 year ago

andreasbakir left a reply on Do I Need Guzzle If I Already Use Axios?

@wilk_randall maybe a bit late I just noticed you replied to me... well it depends on if you setup your project correctly or not laravel does this for you out of the box if you look at the bootstrap.js file in your resources/assets/js folder you will see that axios is set up with a X-CSRF-TOKEN header. This is mandatory (most of the time) if you want to do ajax calls to the api you want to consume.

andreasbakir left a reply on Laravel Ordering Searching

tbh I don't suggest you to go this route... Since changing the order this way requires a full page refresh! Instead use or make use of VueJS.

andreasbakir left a reply on Authentication With Laravel 5.5

@javineo could you provide us with more info, like how the passwords are saved (I believe if it's not bcrypted you can't authenticate..)

I think the best thing todo is to use the User (Eloquent model) which comes pre rendered by a fresh laravel install and define the table column in your User model. search for "Table Names" in the docs.

I believe if you set it up that way you should be able to use laravel as is.



should work fine aswel as the other eloquent functions etc.

27 Jan
1 year ago

andreasbakir left a reply on How Does Jeffrey Make Screencasts Without Keyboard Sounds?

i always thought that he did a voice over AFTER he recorded the screencast

25 Jan
1 year ago

andreasbakir left a reply on How To Manage Jquery 3 And 1 In Same App

@nine it is possible! you just have to add


in your master layout blade file right before the body endtag.

In the blade files you would like to use jquery 1 you will do this

    // jquery 1.12.4 loaded from a cdn
    <script src=""></script>

and in the files you need jquery 3 you should do this

    // jquery 3.3.1 loaded from a cdn
    <script src=""></script>

you don't have to use a cdn, if you would like to you could install the dependencies with npm/yarn bower download them manually etc. etc. but for a starter like you I would suggest not to bother with package managers like these instead use a cdn until you are comfortable enough to switch to a full webpack build. good luck

24 Jan
1 year ago

andreasbakir left a reply on Need Help With Simple Query Builder Code

i guess you are looking for something like this:

    ['id', '=', 15],
    ['id', '=', 1111],