mehran

mehran

Member Since 3 Years Ago

Experience Points 16,225
Experience
Level
Lessons Completed 129
Lessons
Completed
Best Reply Awards 4
Best Answer
Awards
  • 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

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    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.

28 Sep
1 month ago

mehran left a reply on How To Read File Excel! Help

You should be able to read the excel file if you have given the file's address to the load method.

mehran left a reply on Authenticating Users In Phpunit Testing

@Mithrandir OOPS! srry I didn't noticed the API request. Yest if you're using the Passport, there's an easy way to handle the authentication as well.

    Passport::actingAs( factory(User::class)->create() );
    // your request here
    $response = $this->json('POST', '/api/books', [
          'title' => 'book post',
          'author' => 'post author'
     ]);

mehran left a reply on API Not Working On Web Server

API is working well and you may send the authentication headers with your request because you're using the auth:api middleware for your route.

mehran left a reply on Dynamic Admin Route Prefix

You can use an environment variable as well and change the variable from .env file dynamically every time it changes.

But if your settings are more than one, it's better to use the database.

mehran left a reply on Authenticating Users In Phpunit Testing

You may pass the user model to the actingAs method before doing the requests required authentication.

        $user = factory(User::class)->create();

        $this->actingAs($user);

    // Do the request

mehran left a reply on Homestead Newbe Questions..

You may use vagrant ssh to ssh to your virtual machine. Every time you boot your system, it is required to run the vagrant up as well.

mehran left a reply on How To Read File Excel! Help

Give some info about the Excel lib you use as well

27 Aug
2 months ago

mehran left a reply on PHP Laravel Passport - /oauth/tokens 401 Unauthorized

Just to be sure, could you look at the request header to see whether you pass the bearer token correctly and the token is not expired

25 Aug
2 months ago

mehran left a reply on How Can I Retrieve User Id In Controller Based On Get() ?

You already can get the user's id the normal way, just iterate over $freelancers var and use $frelancer->id to get the id

mehran left a reply on PHP Laravel Passport - /oauth/tokens 401 Unauthorized

You can't create new clients if you just pass the forAccessTokens routes to the Passport::routes.

You may add the $this->forClients() aswell.

here's the list of routes you may need in future https://github.com/laravel/passport/blob/master/src/RouteRegistrar.php

27 Jul
3 months ago

mehran left a reply on Where In Array

@Snapey Thanks for your answer, but what's your idea to store an array in the database to make it faster when doing a query?

30 Mar
1 year ago

mehran left a reply on Calling Post Action | Response With 404

Then may you check the route of [email protected]?

mehran left a reply on Calling Post Action | Response With 404

First thing, you may use make rather than create for Post factory.

May you paste the resulting error here?

18 Dec
1 year ago

mehran left a reply on Envoy: Echos Doesn't Work

@TaylorOtwell Laravel.com doesn't have this method documented. Would you tell us whether it is @{{ "Hey, It's echo" }} the correct syntax?

mehran started a new conversation Envoy: Echos Doesn't Work

I was watching the Envoy source code yesterday to see whether I can find a blade syntax for echo.

I think this method should do that and the syntax should be @{{ "Hey, It's echo" }} which will be compiled to echo "Hey, It's echo". But don't know why it gives me this error when running a task:

[[email protected]]: bash: line 2: {{: command not found

13 Dec
1 year ago

mehran left a reply on Automated Password-less Login Via Ssh

Thanks to @mckinnonderek on GitLab.com . his answer helped me out with this issue, here

12 Dec
1 year ago

mehran left a reply on Automated Password-less Login Via Ssh

Thank you @schmidtke182 but this is not what I am looking for. I'm using Gitlab CI to test and then deploy my laravel app via ssh to remote server. GitLab CI uses Docker to doing builds and I can't copy public key to the remote server to use ssh without password. So ithink the only way is using the remote server private key to use ssh without enter password. but I don't have any other idea how to do it.

mehran started a new conversation Automated Password-less Login Via Ssh

It seems an easy to google question but it's 2 days that I can't find what I need. I have a server with an ssh key pair and I want to login to it using the private key.

I also tried ssh-agent but it still prompts for entering password:

$ eval $(ssh-agent -s)
$ ssh-add $SSH_PRIVATE_KEY
$ ssh [email protected]
[email protected]'s password: 
21 Oct
2 years ago

mehran left a reply on Factory Relationships

$p->account->role() returns the relationship object $p->account->role returns the result of the relationship

You are calling attach() method on the result of the role's relationship, not the relationship object ! and it is expected that this code doesn't work.

So you may do this instead:

factory(App\Patient::class, 'male', 20)->create()->each(function($p) {
    $p->account->role()->attach(5);
});
07 Oct
2 years ago

mehran left a reply on Laravel Passport Scopes

If you are using CreateFreshApiToken middleware, so I am not sure whether it is possible to use Token Scopes. Scopes may be useful when you have a Personal access token client.

So let's imagine you want to log in FooBar's website using your Twitter account. When the application redirects you to the twitter's server, then some requested scopes will be displayed to you when you are asked to approve the FooBar's requests.

So I think Laravel ACL is not related to Passport Token Scopes.

01 Oct
2 years ago

mehran left a reply on Elixir - Attribute Removal With --production

You may change the behavior of minifyCss() method. hope it can help.

mehran left a reply on Webpack Problem In Elixir

Make sure if you have buble and buble-loader in your node_modules directory

23 Sep
2 years ago

mehran started a new conversation Build An Extension That Overrides Sass Extension

I'm trying to build an extension for Laravel Elixir and found laravel-elixir-stylus as a good example. What I want is exactly sass extension except that I want to add 2 other plugins to it: rtlcss and postcss.

So should I just add them to Elixir.config.css.sass config and let CSSTask do what I want? Or also override gulpTask() method within CSSTask and pipe some other plugins I want ?

21 Sep
2 years ago

mehran left a reply on Laravel 5.3 Passport Unsupported Grant_type

@Bassam May you show the related code for your Password grant request?

23 Jul
2 years ago

mehran left a reply on Webpack Setup

@stargatesg1 , webpack() just accept this 3 parameters webpack(src, baseDir, output).

15 Jul
2 years ago

mehran left a reply on Passing Form Data + File To An End-point

So what is wrong with my code ?

14 Jul
2 years ago
13 Jul
2 years ago

mehran started a new conversation Passing Form Data + File To An End-point

I use Laravel 5.2 and Vue.js 1.0 and what I want to do is passing a form data + file to a controller. If I don't pass any file, my Vue.js method would be:

data()  {
    return {
        formInputs: {}
    }
},
methods: {
  submitForm (event) {
    var action = event.srcElement.action
    Vue.http.patch(action, this.formInputs)
  }
}

and it works perfectly! But I don't know why I can't pass files using FormData() like this:

methods: {
  submitForm (event) {
    var action = event.srcElement.action

    var image = this.$els.avatar.files[0]

    var form = new FormData(this.formInputs)

    form.append('avatar', image)
    
    Vue.http.patch(action, form)
  }
}

In my Laravel controller, using $request->all() can't fetch any data with the above approach. How do you pass a form data + file ?

11 Jul
2 years ago
09 Jul
2 years ago

mehran left a reply on How It Works VueJS-Resource With Laravel Fields Validations

@cklmercer May you share your plugin with us? Thanks!!

01 Jul
2 years ago

mehran left a reply on Guide: Add Webpack To Your Laravel-Elixir Ext For Vue Js Components

@EmilMoe We can use the next big release of elixir as soon as Taylor releases Laravel 5.3 !!

(Here is what Jeffrey said)[http://www.laravelpodcast.com/episodes/41169-episode-46-laracon-books-jeffrey-hasn-t-read]

30 Jun
2 years ago

mehran left a reply on Grab Old Inputs In Components

@abstractFlo That would be a great approach for other Laravel Helpers like {{ trans() }} !!!!

mehran left a reply on Guide: Add Webpack To Your Laravel-Elixir Ext For Vue Js Components

@Presto How did you fixed this error Uncaught SyntaxError: Unexpected token import ? I get this error when I want to use vuestrap.

mehran left a reply on Guide: Add Webpack To Your Laravel-Elixir Ext For Vue Js Components

@EmilMoe Do ya have any article/guide about how to use Rollup.js and Webpack For laravel ? Or we should wait until Jeffrey will release a new version of elixir?

mehran left a reply on Guide: Add Webpack To Your Laravel-Elixir Ext For Vue Js Components

Thanks @midascodebreaker for your tut! I followed it step by step and even fixed some errors but (still had 1 more error!)[https://github.com/vuejs-templates/webpack/issues/116] So While I was googling for that error, I found a (GitHub repo)(https://github.com/dolbex/webpack-laravel) (Also thanks to dolbex) that has guided me how to successfully integrate vue-cli with my Laravel project!! Yea that works perfectly!

29 Jun
2 years ago

mehran left a reply on To Use Vue Components With Inline Templates Or Not?

Sorry, I just forgot the principles of Asking questions right! Actually, I want to use some Laravel helper methods like {{ trans('foo.bar') }}. For example, I have this inline template in my Laravel views:

<navbar inline-template>
    <li class="nav-item">
        <a class="nav-link hidden-xs-down" href="{{ url('/') }}">
            @{{ auth.user.username }}
        </a>
    </li>
    <li class="nav-item">
        <a class="nav-link hidden-xs-down" href="{{ url('/') }}">
            {{ trans('application.nav-cart') }}
        </a>
    </li>
</navbar>

It works well in this way and I use a Navbar.js as my Vue component. But I can't use these helpers if I use Vuefy format for my components.

I saw Laravel Spark's views are using Vue inline-templates but I'm not sure what other Laravel developers do to handle this. Is it would be well to use inline templates ?

28 Jun
2 years ago

mehran started a new conversation To Use Vue Components With Inline Templates Or Not?

Vue documents say that using inline templates is not a good practice. So What if I define templates inside their components but want to use, for example, Laravel helpers in my templates?

What do you do if you want to use your PHP helpers inside your templates?

12 Jun
2 years ago

mehran left a reply on Making Laravel Updates Automated?

Very helpful. Thanks to all!

mehran left a reply on Making Laravel Updates Automated?

Yes, updating a production software is not a good practice at all. but what if I, for example, make a new git branch of my project and run a shell script that will update the project? plus adding new codes and files comes to the specified Laravel version i want to upgrade to?

mehran started a new conversation Making Laravel Updates Automated?

Hi! I know laravelshift.com that will do it greatly! But I am interested in how it can be done? Let's say I want to create a simple automated-Laravel-update Tool for myself. Is there any idea about what I need to know how to do that?

27 May
2 years ago

mehran left a reply on Laravel CI Testing With GitLab

@bashy @Refringe @noeldiaz Thank You!! The scripts and discuses were really helpful!!

23 May
2 years ago

mehran left a reply on Paying Via PayPal

I forgot to read the laracasts-faqs before opening this discussion. Sorry!

mehran left a reply on Dropzone.js Column 'album_id' Cannot Be Null

Hi @rpauwels . You may pass the album_id as a parameter to back-end within dropzone's config.

lets say you have you album_id within the dropzone-config.js as a variable. (Example: var album_id = {!! $album_id !!};) then it's easy to pass it through params: . somthing like this:

var album_id = {!! $album_id !!};

var myDropzone = new Dropzone(document.body, {
  params: {
    album_id: album_id
  }
});

Now you can use dropzone/bootstrap template and don't need to use forms.

mehran started a new conversation Paying Via PayPal

Hi ! If i pay via PayPal then i should visit laracasts.com/paypal page. But it just happens if i would not be Signed in! So how it detect my account after paying for laracasts?

06 May
2 years ago

mehran started a new conversation Is Laravel Valet Just For Mac?

I'm using Ubuntu as my OS but didn't tried valet on it yet. That's because the related laravel document says Valet is for Macintosh. I'm wrong?

11 Apr
2 years ago

mehran left a reply on Got A PHP Error While Using Tinker

Hi @Petronetto! Actually no! I didn't received any answer and the project was just an exercise not for production.

mehran left a reply on Laravel 5: The Requested URL Was Not Found On This Server.

It's too late for answering, but it still can help other devs.

So It may that under public you have a folder name as "about". That can be source of your problems.