esmaill23

esmaill23

Member Since 6 Months Ago

tehran

backend developer at cinemamarket.ir

Experience Points 1,290
Experience Level 1

3,710 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 4
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

13 May
3 months ago

esmaill23 started a new conversation Eloquent Query Where Post Has No Comments

i have two model or table with names posts and comments in relation one to many .

i want to retrieve all posts that has no comments .

how ?

22 Apr
3 months ago

esmaill23 started a new conversation Eloquent Query That Sum Of Two Column Greater Than A Number

i want to build an eloquent query sum of two column greater than a number like this

$query = Transaction::query();
$query = $query->where('plan_price - final_price','>=',5);

how ?

17 Mar
5 months ago

esmaill23 left a reply on Is This The Correct Way Of Rewriting This Query In Eloquant?

you can use one_to_many or many_to_many relation in eloquent with defin functions in your model replace your joins . it is described in laravel document.

https://laravel.com/docs/5.8/eloquent-relationships

esmaill23 left a reply on How To Undo Php Artisan Make:auth

Go to routes/web.php, delete the created routes by the command make:auth. Remove these two lines and your project will work fine as before.

Auth::routes();

Route::get('/home', '[email protected]');

and in /resource/views remove auth directory

also remove app/controller/Auth directory and user.php in app directory

if you use git you can role back simple without these steps.

15 Mar
5 months ago

esmaill23 left a reply on Add Html Tag In Lang File

@MDELSHAD - your message should be

'resend' => 'Your account is not confirmed. Please click the confirmation link in your e-mail, or <a href=":url">click here</a> to resend the confirmation e-mail.',

and where you use this message you should use

{!! __('resend') !!}
14 Mar
5 months ago

esmaill23 left a reply on Add Html Tag In Lang File

where you use the lang file you must use {!! __('resend') !!} replace { __('resend') }

esmaill23 left a reply on Not Sure How To Get 3 Months

this is your slove :

$from = now();
$to = now() + 3*30*24*60*60;

esmaill23 started a new conversation Export Collection With Laravel Excel

i hava a collection like this :

{"542":{"downloads":1,"seens":3},"2388":{"downloads":1},"3855":{"seens":2}}

i want to export this as excel file with three column id,downloads,seens . how ?

07 Mar
5 months ago

esmaill23 left a reply on Base Url

{{ asset('images/'.$image->img_name) }}

this refer to public/images/ folder and image in it .

esmaill23 left a reply on Php Artisan Not Working

@DAVY_YG - find /etc/php7/apache2

esmaill23 left a reply on Sort Collection In Laravel

finally i found how sort my collection

$col = collect([
    542 => [
        'downloads' => 1
    ], 
    2388 => [
        'downloads' => 3, 
        'seens' => 1
    ], 
    3855 => [
        'seens' => 2
    ]
]);

$sort = "downloads";

$sorted=  $col->sortByDesc(function ($key) {     
        return $key->{$sort} ?? 0;
 });

$sort = "seens";

$sorted=  $col->sortByDesc(function ($key) {     
        return $key->{$sort} ?? 0;
 });

esmaill23 left a reply on Php Artisan Not Working

I think you have loaded mysqli probably twice in php.ini.

Check /etc/php5/apache2 and /etc/php5/cli/. You should not load in each php.ini in this directories the extension mysqli .so. Only one file php.ini should load it.

esmaill23 started a new conversation Sort Collection In Laravel

i have collection like this :

Collection {#897 ▼
  #items: array:3 [▼
    542 => {#891 ▼
      +"downloads": 1
    }
    2388 => {#893 ▼
      +"downloads": 3 
      +"seens":1
    }
    3855 => {#894 ▼
      +"seens": 2
    }
  ]
}

i want to sort this collection base seens value or downloads value

01 Mar
5 months ago

esmaill23 left a reply on Merge Two Array And Create Associative Array

finally i solve this problem simple.

private function mergeDownloadAndSeens($downloads,$seens){
        $response = [];
        foreach ($downloads as $download){
            $response[$download['id']]['downloads'] =  $download['num'];
        }
        foreach ($seens as $seen){
            $response[$seen['id']]['seens'] =  $seen['num'];
        }
        return $response;
    }

esmaill23 left a reply on Laravel Htaccess Doesn't Work On Live Server

you have to add this code to your htaccess .

RewriteBase /

and you should rewrite engine on in your apache virtualhost config

esmaill23 started a new conversation Merge Two Array And Create Associative Array

i have two array like seens=[{num=2,id=5},{num=3,id=4}] and downloads = [{num=1,id=5},{num=4,id=6}] and i want to merge these two array to merge = [5=>{downloads=1,seens=2},4=>{downloads=3},6=>{seens=4}]

how ?

28 Feb
5 months ago

esmaill23 started a new conversation 404 Not Found On Call Api Some Times With Guzzle Http

i want to request to an api with get method and query params but sometimes i get error 404 not found and with refresh more times it work . what is the reason?

GuzzleHttp \ Exception \ ClientException (404)
Client error: `GET http://127.0.0.1:8000/reports?company=11090&type=download&movie_ids=2539%2C3068%2C3069%2C3197%2C3198%2C3199%2C3200%2C3201%2C3202%2C3207%2C3208%2C3209%2C3210%2C3219%2C3220%2C3221%2C3223%2C3224%2C3226%2C3240%2C3242%2C3243%2C3244%2C3245%2C3246%2C3247%2C3248%2C3249%2C3250%2C3251%2C3252%2C3253%2C3293%2C3294%2C3295%2C3296%2C3297%2C3299%2C3300%2C3301%2C3302%2C3303%2C3304%2C3305%2C3306%2C3307%2C3309%2C3310%2C3311%2C3312%2C3313%2C3314%2C3315%2C3316%2C3317%2C3322%2C3323%2C3325%2C3326%2C3327%2C3328%2C3329%2C3330%2C3331%2C3376%2C3377%2C3378%2C3379%2C3380%2C3381%2C3382%2C3383%2C3384%2C3385%2C3386%2C3387%2C3388%2C3389%2C3390%2C3391%2C3392%2C3393%2C3394%2C3395%2C3396%2C3397%2C3398%2C3399%2C3400%2C3401%2C3402%2C3403%2C3406%2C3411%2C3412%2C3413%2C3414%2C3415%2C3416%2C3417%2C3418%2C3419%2C3420%2C3421%2C3422%2C3423%2C3424%2C3428%2C3429%2C3430%2C3431%2C3432%2C3433%2C3434%2C3435%2C3436%2C3437%2C3438%2C3439%2C3440%2C3441%2C3442%2C3443%2C3444%2C3445%2C3446%2C3447%2C3448%2C3449%2C3451%2C3452%2C3453%2C3454%2C3455%2C3456%2C3457%2C3458%2C3459%2C3460%2C3461%2C3483%2C3486%2C3488%2C3489%2C3490%2C3491%2C3492%2C3493%2C3494%2C3495%2C3496%2C3497%2C3498%2C3499%2C3500%2C3504%2C3507%2C3519%2C3527%2C3540%2C3541%2C3542%2C3546%2C3547%2C3548%2C3549%2C3550%2C3551%2C3552%2C3553%2C3554%2C3555%2C3556%2C3557%2C3558%2C3567%2C3570%2C3571%2C3572%2C3573%2C3574%2C3577%2C3599%2C3600%2C3601%2C3602%2C3608%2C3609%2C3612%2C3614%2C3615%2C3616%2C3617%2C3618%2C3625%2C3626%2C3627%2C3630%2C3636%2C3638%2C3640%2C3643%2C3646%2C3647%2C3649%2C3650%2C3654%2C3655%2C3656%2C3657%2C3658%2C3659%2C3661%2C3662%2C3663%2C3664%2C3665%2C3666%2C3667%2C3668%2C3669%2C3673%2C3675%2C3677%2C3683%2C3686%2C3688%2C3690%2C3694%2C3695
21 Feb
5 months ago

esmaill23 started a new conversation Can I Mock Function In My Controller In Browser Test With Laravel Dusk ?

can i mock function in my controller in browser test with laravel dusk ?

esmaill23 left a reply on How Getter Accessor On All Response From Database Laravel

protected $appends = array('transaction_type');

finally i found that add this code in my model, accessor append on response automatically

esmaill23 started a new conversation How Getter Accessor On All Response From Database Laravel

i have an accessor on a field that change this field when i want to access that field in a service. i want to query on database and return all response to another service and i want that accessor operate on all of that field in response. but accessor not act before i want to access that field specially . how i can operate my accessor on all of my response.

19 Feb
5 months ago

esmaill23 left a reply on Dictionary For Save And Retrieve With Eloquent

thank you so much. it is realy simple . :))

17 Feb
6 months ago

esmaill23 left a reply on Dictionary For Save And Retrieve With Eloquent

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Transaction extends Model
{

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'amount', 'description', 'photo', 'transaction_type', 'transaction_num', 'account_owner', 'cid', 'transaction_date', 'type'
    ];

    /**
     * @description Function to return a payment user owner
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function user(){
        return $this->belongsTo('App\User');
    }
}


it is my transactions model. and my transaction_type has four values. i want to save automatically number that define for each value in predefine dictionary and retrieve values replace numbers with eloquent. without any getter or setter function.

esmaill23 left a reply on Dictionary For Save And Retrieve With Eloquent

@SNAPEY - i want to save and retrieve from database with eloquent automatically .

esmaill23 started a new conversation Dictionary For Save And Retrieve With Eloquent

i want to define a dictionary like ["a"=>1,"b"=>2] and for save i pass "a" to eloquent and it save 1 and for retrieve return "a" in results to me . how it possible ?

14 Feb
6 months ago

esmaill23 left a reply on Pagination Without Eloquent

thank you. it work but in my code every time i must request to webservice in every page ?

esmaill23 started a new conversation Pagination Without Eloquent

i need to paginate response that return from another web service to show in my service.

public function index()
    {
        $client = new Client();
        $crashes = $client->request('GET', 'http://localhost:8000/crashes')->getBody()->getContents();
        return view('crashes', ['crashes' => json_decode($crashes)]);
    }

in this code i get a json response from another service and i want to paginate it to show in my view. how ?

12 Feb
6 months ago

esmaill23 left a reply on The Given Data Was Invalid

i try code in try catch with validationException and it worked.

try {
        $rules = array(
                'name' => 'required',
                'password' => 'required'
        );
        $request->validate(
            $rules
        );
    
    } catch (\Illuminate\Validation\ValidationException $e ) {
        return \response($e->errors(),400);
    }

esmaill23 left a reply on The Given Data Was Invalid

@MUNAZZIL - i try this but not work.

$rules = ['name' => 'required']; $validator = $this->validate($request, $rules);

esmaill23 left a reply on The Given Data Was Invalid

i do this but this is not work. and my validation with not pass data always get 500 internal server error and return message that "the given data is invalid"

esmaill23 left a reply on The Given Data Was Invalid

i have this problem too . always return the given data was invalid