irankhosravi

irankhosravi

Member Since 1 Year Ago

Experience Points 15,420
Experience Level 4

4,580 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 1
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.

17 Jul
20 hours ago

irankhosravi left a reply on Javascript D-block Not Working.

Can you send complete codes. because I added below codes in my project.

    function showReferal() {
        document.querySelector('#referral_code').classList.remove('d-none');
        document.querySelector('#referral_code').classList.add('d-block');
    }

It did not work.

irankhosravi left a reply on Javascript D-block Not Working.

OK , So, When I click on advertising and google and friends , referral_code must be hidden. only marketer be show

irankhosravi left a reply on Javascript D-block Not Working.

I edited my post

irankhosravi left a reply on Javascript D-block Not Working.

Which new question?

irankhosravi started a new conversation Javascript D-block Not Working.

We have many radio input.

<input class="form-check-input" type="radio" name="familiar" id="google" value="1">
<input class="form-check-input" type="radio" name="familiar" id="friends" value="2">
<input class="form-check-input" type="radio" name="familiar" id="advertising" value="3">
<input class="form-check-input" type="radio" name="familiar" id="marketer" value="4">

And when I click on #marketer should show #referral_code.

$("#marketer").click(function() {
    $('#referral_code').toggleClass('d-block');
});

irankhosravi left a reply on How To Display An Element With Javascript

We have many radio input.

<input class="form-check-input" type="radio" name="familiar" id="google" value="1">
<input class="form-check-input" type="radio" name="familiar" id="friends" value="2">
<input class="form-check-input" type="radio" name="familiar" id="advertising" value="3">
<input class="form-check-input" type="radio" name="familiar" id="marketer" value="4">

And when I click on #marketer should show #referral_code.

16 Jul
1 day ago

irankhosravi started a new conversation How To Display An Element With Javascript

I want to display #referral_code

    $("#marketer").click(function() {
        $('#referral_code').css('d-block');
    });

The #referral_code is hidden , I want click #referral_code, that be show or block.

08 Jul
1 week ago

irankhosravi left a reply on How To Toggle Div By Clicking Radio Button?

What do you mean?

What's the solution?

irankhosravi left a reply on How To Toggle Div By Clicking Radio Button?

I get this error

TypeError: marketer is not a function

irankhosravi started a new conversation How To Toggle Div By Clicking Radio Button?

By default the both reagent_code should be hidden. By selecting the radio button, have to show the appropriate DIV (following its #id).

html

<div class="form-check form-check-inline">
  <input class="form-check-input" type="radio" name="marketer" id="yes" onclick="marketer(1)" value="1">
  <label class="form-check-label" for="yes">Yes</label>
</div>
<div class="form-check form-check-inline">
  <input class="form-check-input" type="radio" name="marketer" id="no" onclick="marketer(0)" value="0">
  <label class="form-check-label" for="no">No</label>
</div>

footer

<script src="{{ asset('themes/js/jquery-3.3.1.slim.min.js') }}"></script>
<script src="{{ asset('themes/js/jquery.min.js') }}"></script>
<script src="{{ asset('themes/js/popper.min.js') }}"></script>
<script src="{{ asset('themes/js/bootstrap.min.js') }}"></script>
<script src="{{ asset('themes/js/jquery.md.bootstrap.datetimepicker.js') }}"></script>
<script>
    $('#date').MdPersianDateTimePicker({
        targetTextSelector: '#birth_date',
    });
</script>
<script>
    $(document).on('change', '#province_id', function() {
        let province_id = $(this).val();
        let select = $('#city_id');

        $.ajax({
            type: 'get',
            url: '{{ route('findIDProvince') }}',
            data: {'id':province_id},
            success: function(data){
                select.html('');
                for (var i = 0; i < data.length; i++){
                    select.append('<option value="'+data[i].id+'">'+data[i].city_name+'</option>');
                }
            },
            error: function(){
                console.log('this is a error');
            },
        });
    }).trigger('change');

function marketer(x) {
  if (x == 0) {
    document.getElementById('reagent_code').adddClass='d-none';
  } else if (x == 1) {
    document.getElementById('reagent_code').adddClass='d-block';
    return;
  }
}
07 Jul
1 week ago

irankhosravi left a reply on Reagent Code

How does the laravel tracking code work in the user table? If you can put it along with the source and description here.

An application should have, for example, you introduce a friend. Then when you want to register, you register with the code of your agent. Most of this friend's name is registered with your code. Below you can subscribe to this subset. It's a good idea for you to do this in a whisper that you did not say. It might not be in the way of this Hat subset, and maybe the total number of people who became your body code with your body

irankhosravi started a new conversation Reagent Code

How to create reagent code in users table?

irankhosravi left a reply on How To Show Multiple Table In A Blade?

I want to this code for display for example.

<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>

irankhosravi left a reply on How To Show Multiple Table In A Blade?

Yes, my problem here is this. I don't want to this code.

<td>1 4</td>
<td>1 5</td>
<td>1 6</td>
<td>2 4</td>
<td>2 5</td>
<td>2 6</td>
<td>3 4</td>
<td>3 5</td>
<td>3 6</td>

I want to this code for display for example.

<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>

irankhosravi left a reply on How To Show Multiple Table In A Blade?

Yes, my problem here is this. I don't want to this code.

<td>1 4</td>
<td>1 5</td>
<td>1 6</td>
<td>2 4</td>
<td>2 5</td>
<td>2 6</td>
<td>3 4</td>
<td>3 5</td>
<td>3 6</td>

I want to this code for display for example.

<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>
06 Jul
1 week ago

irankhosravi left a reply on How To Show Multiple Table In A Blade?

it is No relationship

irankhosravi started a new conversation How To Show Multiple Table In A Blade?

I have 2 tables orders and order_mobiles in my database. I want to show this 2 tables in my blade.

ReportController.php

public function index() {
    $reports = Order::latest()->where('status', '=', '1')->paginate(50);
    $order_mobiles = OrderMobile::latest()->where('status', '=', '1')->paginate(50);
    return view('Admin.orders.index', compact('reports', 'order_mobiles'));
}

index.blade.php

      @foreach ($reports as $report)
            @foreach ($order_mobiles as $order_mobile)
                <tr>
                    <td>
                        <a href="{{ route('reports.show', $report) }}">
                            {{ $report->name }}
                            {{ $order_mobile->name }}
                        </a>
                    </td>
                    <td>{{ $report->first_name }} {{ $report->last_name }}
                    {{ $order_mobile->first_name }} {{ $order_mobile->last_name }}
                    </td>
                    <td>{{ $report->expert_name }}{{ $order_mobile->expert_name }}</td>
                    <td>{{ $report->received_money }}{{ $order_mobile->received_money }}</td>
                    <td>{{ $report->issue_number }}{{ $order_mobile->issue_number }}</td>
                    <td>{{ jdate($report->update_at)->format('%T') }}{{ jdate($order_mobile->update_at)->format('%T') }}</td>
                </tr>
            @endforeach
      @endforeach

I see and It show bad. What is the best way to display 2 tables?

irankhosravi left a reply on How To 2 Tables In Blade

Oh, I did forget it. But I see and It show bad.

irankhosravi left a reply on How To 2 Tables In Blade

I get this error:

Trying to get property of non-object

irankhosravi started a new conversation How To 2 Tables In Blade

I have 2 tables orders and order_mobiles in my database. I want to show this 2 tables in my blade.

ReportController.php

public function index() {
    $reports = Order::latest()->where('status', '=', '1')->paginate(50);
    $order_mobiles = OrderMobile::latest()->where('status', '=', '1')->paginate(50);
    return view('Admin.orders.index', compact('reports', 'order_mobiles'));
}

index.blade.php

            @foreach ($reports as $report)
            @foreach ($order_mobiles as $order_mobile)
                <tr>
                    <td>
                        <a href="{{ route('reports.show', $report) }}">
                            {{ $report->categories->name }}
                            {{ $order_mobile->categories->name }}
                        </a>
                    </td>
                    <td>{{ $report->user->first_name }} {{ $report->user->last_name }}
                    {{ $order_mobile->user->first_name }} {{ $order_mobile->user->last_name }}
                    </td>
                    <td>{{ $report->expert_name }}{{ $order_mobile->expert_name }}</td>
                    <td>{{ $report->received_money }}{{ $order_mobile->received_money }}</td>
                    <td>{{ $report->issue_number }}{{ $order_mobile->issue_number }}</td>
                    <td>{{ jdate($report->update_at)->format('%T') }}{{ jdate($order_mobile->update_at)->format('%T') }}</td>
                </tr>
            @endforeach
            @endforeach

irankhosravi started a new conversation Why Session Cleared After Refreshing Page Laravel

I have a little problem about sessions in Laravel.

I have made the authentication function which like this:

    $mobile = $request->session()->put('mobile',$request->mobile);
04 Jul
1 week ago

irankhosravi left a reply on How To Display A Variable In Sweet Alert?

@CRONIX - You were not that, You remember, that you helped me. dear friend

03 Jul
2 weeks ago

irankhosravi left a reply on How To Display A Variable In Sweet Alert?

@CRONIX - You were not that, You remember, that you helped me. dear friend

01 Jul
2 weeks ago

irankhosravi left a reply on How To Display A Variable In Sweet Alert?

Oh

My Controller

 $code = $request->code;
 alert()->success('<br><span class=\'border\'>Your code is {{ $code }}.</span>"', 'ok')->persistent('ok')->html();

irankhosravi left a reply on How To Display A Variable In Sweet Alert?

Can you send complete for me?

Thank you.

irankhosravi started a new conversation How To Display A Variable In Sweet Alert?

I want to display a variable in sweet alert on my blade.

alert()->success('<span class='border'>Your code is {{ $code }}."', 'ok')->persistent('ok')->html();

29 Jun
2 weeks ago

irankhosravi left a reply on Maximum Execution Time Of 60 Seconds Exceeded

@TYKUS - No, I use in localhost now.

irankhosravi started a new conversation Maximum Execution Time Of 60 Seconds Exceeded

I tried solve my report for download pdf. But I have a problem. When I download pdf. I see an error for first time.

In my php.ini max_execution_time is 1800. and when I click on pdf download I see this error.

Maximum execution time of 60 seconds exceeded

irankhosravi left a reply on Undefined Variable: Order

@EDOC - I get this error again.

Undefined variable: order (View: C:\xampp\htdocs\urmiahardware\magzrayaneh\resources\views\Home\report.blade.php)

irankhosravi started a new conversation Undefined Variable: Order

I want to export pdf for each report from logined a user. I worked with pdf and laravel for first time.

Look at my codes.

my blade

<a class="btn btn-primary btn-sm" href="{{ route('report-export-pdf', $order) }}">Download PDF</a>

web.php

Route::get('report/export-pdf', '[email protected]_pdf')->name('report-export-pdf');

ReportController.php

public function export_pdf(Order $order)
{
    $report =  Report::find($order);
// $pdf = PDF::loadView('Home.report')->setPaper('a4', 'portrait');
    $pdf = app('dompdf.wrapper');
    $pdf->loadView('Home.report');
    $fileName = $report->issue_number;
    return $pdf->stream($fileName.'.pdf');
}

I get this error.

Undefined variable: order (View: C:\xampp\htdocs\urmiahardware\magzrayaneh\resources\views\Home\report.blade.php)

irankhosravi left a reply on Route [report.export-pdf] Not Defined.

@SNAPEY - What's the solution?

You can help.

irankhosravi left a reply on Route [report.export-pdf] Not Defined.

@TRAY2 - Yes I do it but I get this error

Undefined variable: order (View: C:\xampp\htdocs\urmiahardware\magzrayaneh\resources\views\Home\report.blade.php)

irankhosravi left a reply on Route [report.export-pdf] Not Defined.

@TRAY2 - I get this error again

Missing required parameters for [Route: report-export-pdf] [URI: report/export-pdf/{order}]. (View: C:\xampp\htdocs\urmiahardware\magzrayaneh\resources\views\Home\report.blade.php)

irankhosravi started a new conversation Route [report.export-pdf] Not Defined.

I want to export pdf for each report from logined a user. I worked with pdf and laravel for first time.

Look at my codes.

my blade

<a class="btn btn-primary btn-sm" href="{{ route('report.export-pdf') }}">Download PDF</a>

web.php

Route::get('report/export-pdf', '[email protected]_pdf')->name('report.export-pdf');

ReportController.php

public function export_pdf(Order $order)
{
    $report =  Report::find($order);
    //$pdf = PDF::loadView('Home.report')->setPaper('a4', 'portrait');
    $pdf = app('dompdf.wrapper');
    $pdf->loadView('Home.report');
    $fileName = $report->issue_number;
    return $pdf->stream($fileName.'.pdf');
}

I get this error.

irankhosravi left a reply on Non-static Method Barryvdh\DomPDF\PDF::loadView() Should Not Be Called Statically

@BOBBYBOUWMANN - I get this error.

Undefined variable: order (View: C:\xampp\htdocs\urmiahardware\magzrayaneh\resources\views\Home\report.blade.php)

Then I changed this my codes.

public function export_pdf(Order $order)
{
    $report =  Report::findOrFail($order);
    //$pdf = PDF::loadView('Home.report')->setPaper('a4', 'portrait');
    $pdf = app('dompdf.wrapper');
    $pdf->loadView('Home.report');
    $fileName = $report->issue_number;
    return $pdf->stream($fileName.'.pdf');
}
28 Jun
2 weeks ago

irankhosravi started a new conversation Non-static Method Barryvdh\DomPDF\PDF::loadView() Should Not Be Called Statically

I want to export pdf for each report from logined a user.

Look at my codes.

my blade

<a class="btn btn-primary btn-sm" href="{{ route('report.export-pdf') }}">Download PDF</a>

web.php

Route::get('report/export-pdf', '[email protected]_pdf')->name('report.export-pdf');

ReportController.php

public function export_pdf(Report $report)
{
    $report =  Report::findOrFail($report);
    $pdf = PDF::loadView('Home.report')->setPaper('a4', 'portrait');
    $fileName = $report->issue_number;
    return $pdf->stream($fileName.'.pdf');
}
23 Jun
3 weeks ago

irankhosravi left a reply on Laravel Explode Not Working

Answer my question

irankhosravi left a reply on Laravel Explode Not Working

I create multiple checkboxes and I stored implode computer

order.blade.php

<form action="{{ route('store') }}" method="post">
    <input type="checkbox" name="computer[]" value="1" id="hp">
    <label for="hp">HP</label>
    <input type="checkbox" name="computer[]" value="2" id="dell">
    <label for="dell">DELL</label>
    <input type="checkbox" name="computer[]" value="3" id="asus">
    <label for="asus">ASUS</label>
    <input type="checkbox" name="computer[]" value="4" id="acer">
    <label for="acer">ACER</label>
    <input type="checkbox" name="computer[]" value="5" id="sony">
    <label for="sony">Sony</label>
    <input type="checkbox" name="computer[]" value="6" id="fujitsu">
    <label for="fujitsu">Fujitsu</label>
    <input type="checkbox" name="computer[]" value="other_barnds" id="other_barnds">
    <label for="other_barnds">Other</label>
           <input type="submit" class="btn btn-primary" value="Save">
</form>

OrderController.php

public function store(Request $request)
{
    $this->validate(request(), [
        'computer' => 'required'
    ]);

    $order = Order::where('user_id',auth()->id())
        ->where('computer', request('computer'))
        ->exists(); 
            
    $order = new Order($request->all());
    $order->user_id = auth()->user()->id;
    $order->description = $request->description;
    $computer = implode(",", $request->computer);
    $order->computer = $computer;
    $order->save();

    if ($order) {
        alert()->error('Warning', 'You ordered already');
        return redirect()->back();
    }
}

irankhosravi started a new conversation Laravel Explode Not Working

I did save computer field like implode.

implode

$order = Order::where('user_id',auth()->id())
    ->explode( 'computer', request('computer'));

irankhosravi left a reply on Implode(): Invalid Arguments Passed

@SNAPEY - I pressed submit button.

irankhosravi started a new conversation Implode(): Invalid Arguments Passed

A user cannot bid on a order more than once. If the user clicks on the order again, he should be prompted with a response page noting the user of having previously bid on the order.

I create multiple checkboxes and I stored implode computer

order.blade.php

<form action="{{ route('store') }}" method="post">
    <input type="checkbox" name="computer[]" value="1" id="hp">
    <label for="hp">HP</label>
    <input type="checkbox" name="computer[]" value="2" id="dell">
    <label for="dell">DELL</label>
    <input type="checkbox" name="computer[]" value="3" id="asus">
    <label for="asus">ASUS</label>
    <input type="checkbox" name="computer[]" value="4" id="acer">
    <label for="acer">ACER</label>
    <input type="checkbox" name="computer[]" value="5" id="sony">
    <label for="sony">Sony</label>
    <input type="checkbox" name="computer[]" value="6" id="fujitsu">
    <label for="fujitsu">Fujitsu</label>
    <input type="checkbox" name="computer[]" value="other_barnds" id="other_barnds">
    <label for="other_barnds">Other</label>
</form>

OrderController.php

public function store(Request $request)
{
    $this->validate(request(), [
        'computer' => 'required'
    ]);

    $order = Order::where('user_id',auth()->id())
        ->where('computer', request('computer'))
        ->exists(); 
            
    $order = new Order($request->all());
    $order->user_id = auth()->user()->id;
    $order->description = $request->description;
    $computer = implode(",", $request->computer);
    $order->computer = $computer;
    $order->save();

    if ($order) {
        alert()->error('Warning', 'You ordered already');
        return redirect()->back();
    }
}

I get this error.

implode(): Invalid arguments passed

22 Jun
3 weeks ago