irankhosravi

irankhosravi

Member Since 1 Year Ago

Experience Points 14,580
Experience Level 3

420 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 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.

23 Jun
2 days 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 days ago

irankhosravi left a reply on How To Order A Select The Checkboxes Product Only Once In Laravel?

How to put value of checkvboxes to set json.

I decided to set json value

irankhosravi started a new conversation How To Order A Select The Checkboxes Product Only Once In Laravel?

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();
    }
}
21 Jun
4 days ago

irankhosravi left a reply on How To Send Email After Register In Laravel?

@CRONIX - If I've read them and did it, Will work it.

irankhosravi started a new conversation How To Send Email After Register In Laravel?

I am a novice. I want to send email after register with laravel.

How to should I do?

Please help me.

19 Jun
6 days ago

irankhosravi left a reply on How To Change Password?

@SNAPEY - No I want to edit the password and email and address.

irankhosravi left a reply on How To Change Password?

I swear to God that I do not intend to interfere in this free forum.

I just have a difficult project for first time that I can not solve.

And I think in the next project I do not need to ask the forum.

I am a job of programming Laravel. I love Laravel.

I tried in watches but I did not solve my problem.

irankhosravi left a reply on How To Change Password?

Answer my question.

irankhosravi started a new conversation How To Change Password?

I want to edit form form update only address, email and password. How to change password?

Old Password is important.

edit.blade.php

<form method="POST" action="{{ route('update') }}">
    @csrf
    {{ method_field('PATCH') }}
    <div class="form-group row">
        <label for="email" class="col-md-1 col-form-label text-md-right">{{ __('Email') }}</label>

        <div class="col-md-5">
            <input id="email" type="text" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') ? : user()->email }}" required autocomplete="email" autofocus>

            @error('email')
            <span class="invalid-feedback" role="alert">
                    <strong>{{ $message }}</strong>
                </span>
            @enderror
        </div>
    </div>

    <div class="form-group row">
        <label for="password" class="col-md-1 col-form-label text-md-right">{{ __('Password') }}</label>

        <div class="col-md-5">
            <input id="password" type="text" class="form-control @error('password') is-invalid @enderror" name="password" value="{{ old('password') }}" required autocomplete="password" autofocus>

            @error('password')
            <span class="invalid-feedback" role="alert">
                    <strong>{{ $message }}</strong>
                </span>
            @enderror
        </div>
    </div>

    <div class="form-group row">
        <label for="address" class="col-md-1 col-form-label text-md-right">{{ __('Address') }}</label>

        <div class="col-md-5">
            <textarea id="address" type="text" class="form-control @error('address') is-invalid @enderror" name="address" required autocomplete="address" autofocus>{{ old('address') ? : user()->address }}</textarea>

            @error('address')
            <span class="invalid-feedback" role="alert">
                    <strong>{{ $message }}</strong>
                </span>
            @enderror
        </div>
    </div>

    <div class="form-group row mb-0">
        <div class="col-md-1">
            <button type="submit" class="btn btn-block btn-primary">
                {{ __('Register') }}
            </button>
        </div>
    </div>
</form>

web.php

Route::post('update', 'Auth\[email protected]')->name('update');

RegisterController.php

 public function sqlupdate(Request $request)
{
    Auth::user()->update([
        'address' => $request['address'],
        'email' => $request['email'],
    ]);

    $hashedPassword = auth()->user()->password;
    if (Hash::check($request->oldpassword, $hashedPassword)){
        $user = User::findOrFail(Auth::id());
        $user->password = Hash::make($request->password);
    }
    return redirect()->back();
}

irankhosravi left a reply on How To Display Report When Report Is Empty?

@RAS1212 - Yes, I passed $request from the controller.

public function index()
{
    $reports = Report::latest()->where('status', '=', '0')->paginate(50);
    return view('Admin.reports.index', compact('reports'));
}

irankhosravi started a new conversation How To Display Report When Report Is Empty?

My report is empty but run admin panel. I see this error. Undefined variable: report

I bet that if it was empty then ....

@if(!$report)
    <form action="{{ route('reports.update', ['id' => $report->id]) }}" method="post">
    .
    .

@endif

18 Jun
1 week ago

irankhosravi left a reply on How To Create Send Code Again?

element.innerHTML = '<a href="{{ route('sendAgainCode')}} class="float-left">Send sms again';

irankhosravi left a reply on How To Create Send Code Again?

Answer my s=question.

irankhosravi left a reply on How To Create Send Code Again?

No this form is send controller , I want to click in Send code again for send verification code

irankhosravi left a reply on How To Create Send Code Again?

@MVD - ``` @extends('Home.master')

@section('content')

<div id="networks" class="pt-5 mt-5">
    <div class="container">
        <div class="row">
            <div class="col-md-4 m-auto">
                <div class="card mt-3">
                    <div class="card-header">
                        <h4>Code</h4>
                    </div>
                    <div class="card-body">
                        <form action="{{ route('send') }}" method="post">
                            {{ csrf_field() }}
                            <input type="hidden" class="form-control" value="{{ Session::get('mobile') }}" name="mobile" id="mobile">
                            <div class="form-group">
                                <label for="code">Code</label>
                                <input type="text" class="form-control" name="code" id="code">
                            </div>
                            <div class="form-group">
                                <button type="submit" class="btn btn-danger" id="btn-ok">OK</button>
                                <span class="float-left" id="status"></span>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

@endsection

@section('script') function countDown(secs, elem) { var element = document.getElementById(elem); element.innerHTML = "Please wait "+secs+" seconds"; if (secs < 0){ clearTimeout(timer); element.innerHTML = '<a href="{{ route('sendAgainCode')}} class="float-left">Send sms again'; } var timer = setTimeout('countDown('+secs+', "'+elem+'")', 1000); } countDown(5, "status") @endsection

irankhosravi left a reply on How To Create Send Code Again?

@BOBBYBOUWMANN - I want to create verification code again? I think the code should update.

sendsode

I get this error.

404

irankhosravi started a new conversation How To Create Send Code Again?

Look at my code

web.php

 Route::post('/send-again-code', '[email protected]')->name('sendAgainCode');

HomeController.php

public function sendAgainCode ()
{
    $code = rand(1000,9999);

    try {
        $api = new \Kavenegar\KavenegarApi("706D634C704761587945382B666A562B344D363537325459786E637850574C2F");
        $sender = "10004346";
        $message  = $code;
        $receptor = auth()->user()->mobile;
        $result = $api->Send($sender, $receptor, $message);
        if ($result) {
            foreach ($result as $r) {
                echo "messageid = $r->messageid";
                echo "message = $r->message";
                echo "status = $r->status";
                echo "statustext = $r->statustext";
                echo "sender = $r->sender";
                echo "receptor = $r->receptor";
                echo "date = $r->date";
                echo "cost = $r->cost";
            }
        }
    } catch (\Kavenegar\Exceptions\ApiException $e) {
        echo $e->errorMessage();
    } catch (\Kavenegar\Exceptions\HttpException $e) {
        echo $e->errorMessage();
    }
}
16 Jun
1 week ago

irankhosravi left a reply on How To Get Category_id For Save The Reports?

I want to get order for report page.

irankhosravi left a reply on Method Illuminate\Validation\Validator::validateRequired|mimes Does Not Exist.

@KANE - But I see all files I want to see jpeg,png,bmp.

all files

irankhosravi started a new conversation Method Illuminate\Validation\Validator::validateRequired|mimes Does Not Exist.

The register validate not woring.

RegisterController.php

public function register(UserRequest $request, User $user)
{
    $code = rand(10000,99999);
    $mobile = $request->session()->get('mobile');
    $user = \App\User::create([
        'first_name' => $request->first_name,
        'last_name' => $request->last_name,
        'gender' => $request->gender,
        'mobile' => $request->mobile,
        'code' => $code,
        'address' => $request->address,
        .
        .
        .
        .
}

UserRequest.php

public function rules()
{
    return [
        'first_name' => ['required', 'string', 'max:255'],
        'last_name' => ['required', 'string', 'max:255'],
        'gender' => ['required', 'string', 'max:255'],
        'mobile' => ['required', 'string', 'max:255', 'unique:users'],
        'image' => ['required|mimes:jpeg,png,bmp'],
        'address' => ['required', 'string', 'max:255'],
        'birth_date' => ['required', 'string', 'max:255'],
        'province_id' => ['required'],
        'city_id' => ['required'],
        'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
        'password' => ['required', 'string', 'min:6', 'confirmed'],
    ];
}

register.blade.php

@if ($errors->any())
    <div class="alert alert-danger">
        <ul>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
    </div>
@endif

but it did not working I see this error.

Method Illuminate\Validation\Validator::validateRequired|mimes does not exist.

irankhosravi left a reply on How To Get Category_id For Save The Reports?

@SNAPEY - OK , I want the same.

How should I do?

irankhosravi left a reply on How To Get Category_id For Save The Reports?

@DEANSATCH - First of all, click on this link https://laracasts.com/discuss/channels/laravel/how-to-create-report-after-select-an-order . I want to create report and when after a user press the save button. get the information for save category_id. for save reports.

irankhosravi left a reply on How To Get Category_id For Save The Reports?

@DEANSATCH - In this line return redirect()->route('reports.show', $order);

irankhosravi started a new conversation How To Get Category_id For Save The Reports?

Look at my codes.

web.php

Route::get('/internets', '[email protected]')->name('internets');
Route::post('/internets/store', '[email protected]')->name('internets.store');

Route::get('reports/show/{order}', '[email protected]')->name('reports.show');
Route::post('reports/store', '[email protected]')->name('reports.store');

InternetController.php

public function store(Request $request)
{
    if (auth()->check()) {
        $order = new Order($request->all());
        $order->category_id = $request->category_id;
        $order->user_id = auth()->user()->id;
        $order->status = 0;
        $order->description = $request->description;
        $order->save();
        alert()->success('ok')->persistent("ok");
        return redirect()->route('reports.show', $order);
    }
}

When I press save button. I see http://localhost:8000/reports/show/5 in address bar.

How to get this 5 for save the category_id.

show.blade.php

        <form action="{{ route('reports.store') }}" method="post">
            @csrf
            <div class="card">
                <div class="table-responsive">
                    <table class="table">
                        <thead>
                        <tr>
                            <th>first_name </th>
                            <th>last_name </th>
                            <th>mobile</th>
                            <th>city</th>
                            <th>category name</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>{{ $order->user->first_name }}</td>
                            <td>{{ $order->user->last_name }}</td>
                            <td>{{ $order->user->mobile }}</td>
                            <td>{{ $order->user->city->city_name }}</td>
                            <td>{{ $order->categories->name }}</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
                <div class="card-body">
                    <h3>Expert visit time</h3>
                    <div class="row">
                        <div class="col-md-7">
                            <div class="input-group">
                                <div class="input-group-prepend">
                        <span class="input-group-text cursor-pointer" id="date">
                            <i class="fas fa-calendar-alt"></i>
                        </span>
                                </div>
                                <div class="row">
                                    <div class="col-sm-6">
                                        <input type="text" name="date" id="inputDate" class="form-control" placeholder="date" aria-label="date" aria-describedby="date">
                                    </div>
                                    <div class="col-md-6">
                                        <div class="input-group date" id="datetimepicker3" data-target-input="nearest">
                                            <input type="text" name="time" class="form-control datetimepicker-input" data-target="#datetimepicker3"/>
                                            <div class="input-group-append" data-target="#datetimepicker3" data-toggle="datetimepicker">
                                                <div class="input-group-text"><i class="fas fa-clock"></i></div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-5">
                            <p class="float-left m-0">{{ $order->description }}</p>
                        </div>
                    </div>
                </div>
                <div class="card-footer">
                    <button class="btn btn-primary">Is it ok?</button>
                </div>
            </div>
        </form>

ReportController.php

public function show (Order $order)
{
    return view('Home.report', compact('order'));
}

public function store (Request $request)
{
    $report = new Report($request->all());
    $report->date = $request->date;
    $report->time = $request->time;
    $report->category_id = category_id;
    $report->save();
}
15 Jun
1 week ago

irankhosravi left a reply on Laravel 5.8 @can Not Working

@NASH - What is the ssolution?

14 Jun
1 week ago

irankhosravi started a new conversation How To Create Report After Select An Order?

Look at my codes.

public function store(Request $request)
{
    if (auth()->check()) {
            $order = new Order($request->all());
            $order->category_id = $request->category_id;
            $order->user_id = auth()->user()->id;
            $order->status = 0;
            $order->description = $request->description;
            $order->save();
            session([$order->id => $order->id]);
            alert()->success('ok')->persistent("ok");
            return redirect()->route('reports.show')->with('order_id', $order->id);
    }
}

web.php

 Route::get('reports/show/{order}', '[email protected]')->name('reports.show');

ReportController.php

public function show (Order $order)
{
    return view('reports.show', compact('order'));
}

I get this error.

Undefined variable: order (View: C:\xampp\htdocs\new\khosravi-shop\resources\views\Home\report.blade.php)

irankhosravi started a new conversation How To Get Id In Session For Next Page?

I have an order and I want to after save, get in session current id of order for next page reports.

use Session;

public function store(Request $request)
{
            $order = new Order($request->all());
            $order->user_id = auth()->user()->id;
            $order->title = $request->title;
            $order->body = $request->body;
            $order->id = $request->session()->get('id');
            $order->description = $request->description;
            $order->save();
            session(['order_id' => $order_id]);
            return redirect()->route('reports.index')->with('order_id', $request->id);
}

In notes page has a input hidden for get session of article id.

     <input type="hidden" class="form-control" value="{{ Session::get('order_id') }}" name="id" id="id">

But I see input hidden. It is blank . "".

irankhosravi left a reply on How To Get Id In Session?

@JOHNBRAUN - We do not have article_id.

irankhosravi left a reply on How To Get Id In Session?

@JOHNBRAUN - What is this line?

session(['article_id' => $article_id]);

irankhosravi started a new conversation How To Get Id In Session?

I have an article and I want to after save, get in session current id of article for next page notes.

use Session;

public function store(Request $request)
{
            $article = new Article($request->all());
            $article->user_id = auth()->user()->id;
            $article->title = $request->title;
            $article->body = $request->body;
            $article->id = $request->session()->get('id');
            $article->description = $request->description;
            $article->save();
            return redirect()->route('notes.index')->with('id', $request->id);
}

In notes page has a input hidden for get session of article id.

     <input type="hidden" class="form-control" value="{{ Session::get('id') }}" name="id" id="id">

irankhosravi started a new conversation How To Login Admin, Direct Go To Admin Panel

I want to when login admin redirect to admin/panel in laravel

public function handle($request, Closure $next)
{
    if (auth()->check())
    {
        if (auth()->user()->isAdmin() || auth()->user()->isOperator()) {
            //return $next($request);
            return redirect()->route('panel.index');
        }
    }
    return redirect('/login');
}

but it did not work.

13 Jun
1 week ago

irankhosravi left a reply on Laravel 5.8 @can Not Working

I am very involved with why it does not work

irankhosravi left a reply on Laravel 5.8 @can Not Working

create_roles_table

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateRolesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('roles', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name');
            $table->string('label')->nullable();
            $table->timestamps();
        });

        Schema::create('permissions', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name');
            $table->string('label')->nullable();
            $table->timestamps();
        });

        Schema::create('permission_role', function (Blueprint $table) {
            $table->bigInteger('role_id')->unsigned();
            $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');

            $table->bigInteger('permission_id')->unsigned();
            $table->foreign('permission_id')->references('id')->on('permissions')->onDelete('cascade');

            $table->primary(['role_id' , 'permission_id']);
        });

        Schema::create('role_user', function (Blueprint $table) {
            $table->bigInteger('role_id')->unsigned();
            $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');

            $table->bigInteger('user_id')->unsigned();
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');

            $table->primary(['role_id' , 'user_id']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('roles');
    }
}
12 Jun
1 week ago

irankhosravi left a reply on Laravel 5.8 @can Not Working

How many days does it take. @can still can not work. I found the problem. When // I put. The problem is resolved.

AuthServiceProvider.php

public function boot()
{
    $this->registerPolicies();
    foreach ($this->getPermissions() as $permission) {
        Gate::define($permission->name , function ($user) use($permission){
            return $user->hasRole($permission->roles);
        });
    }
}

protected function getPermissions()
{
    return Permission::with('roles')->get();
}

irankhosravi left a reply on How To Get Session Mobile In Laravel

I changed it $mobile = $request->session()->get('mobile'); in controller. But I did not change in input hidden blade.