irankhosravi

Experience

5,360

0 Best Reply Awards

  • Member Since 9 Months Ago
  • 1 Lesson Completed
  • 0 Favorites

25th September, 2018

irankhosravi left a reply on LocalStorage With Laravel Not Working • 6 hours ago

I changed my codes:

 localStorage.setItem('new_school_id', JSON.stringify(_school_id));
 JSON.parse(localStorage.getItem('new_school_id'));

It did not work.

24th September, 2018

irankhosravi left a reply on LocalStorage With Laravel Not Working • 1 day ago

Help please

irankhosravi left a reply on LocalStorage With Laravel Not Working • 1 day ago

I changed my codes:

 localStorage.setItem('new_school_id', JSON.stringify(_school_id));
 JSON.parse(localStorage.getItem('new_school_id'));

It did not work.

irankhosravi left a reply on LocalStorage With Laravel Not Working • 1 day ago

Please help that how to send new_school_id for controller to save.

irankhosravi left a reply on LocalStorage With Laravel Not Working • 1 day ago

Please help that how to send new_school_id for controller to save.

irankhosravi left a reply on LocalStorage With Laravel Not Working • 1 day ago

I changed my codes:

 localStorage.setItem('new_school_id', JSON.stringify(_school_id));
 JSON.parse(localStorage.getItem('new_school_id'));

It is not worked.

irankhosravi left a reply on LocalStorage With Laravel Not Working • 1 day ago

Please help me. Thank you

23rd September, 2018

irankhosravi left a reply on LocalStorage With Laravel Not Working • 2 days ago

Please help that how to send new_school_id for controller to save.

irankhosravi left a reply on LocalStorage With Laravel Not Working • 2 days ago

You have to STOP saying that.

DELETE IT

irankhosravi left a reply on LocalStorage With Laravel Not Working • 2 days ago

Answer my question.

irankhosravi left a reply on LocalStorage With Laravel Not Working • 2 days ago

Answer my question.

irankhosravi left a reply on LocalStorage With Laravel Not Working • 2 days ago

Answer

irankhosravi left a reply on LocalStorage With Laravel Not Working • 2 days ago

I created the school form beforehand and and save it in my schools table before.

var _school_id = 0; $("#schools").submit(function (event) { event.preventDefault(); province_id = $('#province_id').val(); city_id = $('#city_id').val(); center_id = $('#center_id').val(); national_number_founder = $('#national_number_founder').val(); school_name = $('#school_name').val(); status = $('#status').val(); gender = $('#gender').val(); area = $('#area').val(); note = $('#note').val(); type = $('#type').val(); file_number = $('#file_number').val(); phone = $('#phone').val(); address = $('#address').val(); postal_code = $('#postal_code').val(); building = $('#building').val(); date_establishment = $('#date_establishment').val(); $.post("{{ route('schools-list.store') }}", {province_id:province_id, city_id:city_id, center_id:center_id, national_number_founder:national_number_founder, school_name:school_name, status:status, gender:gender, note:note, type:type, file_number:file_number, phone:phone, address:address, postal_code:postal_code, building:building, area:area, date_establishment:date_establishment}, function (data_school) { var school_id = {school_id: data_school.id}; school_id = (school_id['school_id']); _school_id = school_id; console.log(_school_id); localStorage.setItem('new_school_id', JSON.stringify(_school_id)); var school_id = _school_id; jQuery.each(data_school.errors, function(key, value){ jQuery('.alert-danger').show(); jQuery('.alert-danger').append('

'+value+'

'); }); }); });

irankhosravi started a new conversation LocalStorage With Laravel Not Working • 2 days ago

How to define when save a variable in localStorage to send controller.

    var school_id = {school_id: data_school.id};
    localStorage.setItem('new_school_id', JSON.stringify(_school_id));

For example I defined a variable new_school_id.

Now how to defined for save in controller.

   $requisition->school_id = intval($request->new_school_id);

I get this error.

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (prj_tvto.requisitions, CONSTRAINT requisitions_school_id_foreign FOREIGN KEY (school_id) REFERENCES schools (id)) (SQL: insert into requisitions (user_id, school_id, type, date, status, approved, updated_at, created_at) values (1, 0, 2, 0, 0, 0, 2018-09-16 09:33:56, 2018-09-16 09:33:56))

16th September, 2018

irankhosravi left a reply on LocalStorage In Laravel With Javascript Not Working. • 1 week ago

Can you give code samples? Thanks for answer.

irankhosravi left a reply on LocalStorage In Laravel With Javascript Not Working. • 1 week ago

Is there anyone answering my question?

irankhosravi left a reply on LocalStorage In Laravel With Javascript Not Working. • 1 week ago

Is there anyone answering my question?

irankhosravi left a reply on LocalStorage In Laravel With Javascript Not Working. • 1 week ago

I know. I inserted new schools form or table already. Then I school.id defined in localStorage

then how to save new_school_id

irankhosravi left a reply on LocalStorage In Laravel With Javascript Not Working. • 1 week ago

I know. I inserted new schools form or table already. Then I school.id defined in localStorage

then how to save new_school_id

irankhosravi left a reply on LocalStorage In Laravel With Javascript Not Working. • 1 week ago

I know. I inserted new schools form or table already. Then I school.id defined in localStorage

irankhosravi started a new conversation LocalStorage In Laravel With Javascript Not Working. • 1 week ago

How to define when save a variable in localStorage to send controller.

    var school_id = {school_id: data_school.id};
    localStorage.setItem("new_school_id", school_id );

For example I defined a variable new_school_id.

Now how to defined for save in controller.

   $requisition->school_id = intval($request->show_school_id);

I get this error.

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (prj_tvto.requisitions, CONSTRAINT requisitions_school_id_foreign FOREIGN KEY (school_id) REFERENCES schools (id)) (SQL: insert into requisitions (user_id, school_id, type, date, status, approved, updated_at, created_at) values (1, 0, 2, 0, 0, 0, 2018-09-16 09:33:56, 2018-09-16 09:33:56))

15th September, 2018

irankhosravi started a new conversation Missing Required Parameters For [Route: Requisitions.update] [URI: Admin/requisitions/{school}]. (View: C:\xampp\htdocs\project\tvto\resources\v • 1 week ago

Hi what is this error?

Missing required parameters for [Route: requisitions.update] [URI: admin/requisitions/{school}]. (View: C:\xampp\htdocs\project\tvto\resources\views\Admin\requisitions\edit.blade.php)

I changed my single Routes to the my project. Route::resource('admin/requisitions', 'RequisitionController', ['parameters' => ['requisitions' => 'school']]);

Maybe you can help me.

RequisitionController.php

public function edit(Requisition $requisition)
{
    return view('Admin.requisitions.edit', $requisition);
}

Admin/requisitions/edit.blade.php

<form action="{{ route('requisitions.update')}}" method="post">
    {{ csrf_field() }}
    {{ method_field('update') }}
    <div class="radio">
    ...
    </div>
</form>

irankhosravi started a new conversation No Query Results For Model [App\Requisition]. • 1 week ago

When I go to address http://localhost:8000/requisitions/5/edit I get this error.

No query results for model [App\Requisition].

Of course I putted use App\Requisition; in my code.

14th September, 2018

irankhosravi left a reply on How Do I Get All Select Elements That Do Not Have An Option Selected Using JQuery? • 1 week ago

What code? I need find select option in jQuery.

irankhosravi left a reply on How Do I Get All Select Elements That Do Not Have An Option Selected Using JQuery? • 1 week ago

For example in textbox:

    parent_fieldset.find('input[type="text"], input[type="number"]').each(function() {
        if( $(this).val() == "" ) {
            $(this).addClass('input-error');
            next_step = false;
        }
        else {
            $(this).removeClass('input-error');
        }
    });

This code works well. But for <select><option></option></select>, I don't know.

irankhosravi left a reply on How Do I Get All Select Elements That Do Not Have An Option Selected Using JQuery? • 1 week ago

Ok, I mean <select><option></option></select> . Not checked``

13th September, 2018

irankhosravi left a reply on How Do I Get All Select Elements That Do Not Have An Option Selected Using JQuery? • 1 week ago

Ok, I mean <select><option></option></select> . Not checked``

irankhosravi left a reply on How Do I Get All Select Elements That Do Not Have An Option Selected Using JQuery? • 1 week ago

Ok, I mean <select><option></option></select> .

irankhosravi started a new conversation How Do I Get All Select Elements That Do Not Have An Option Selected Using JQuery? • 1 week ago

What would the jQuery selector be that would return just a based on no selection?

    parent_fieldset.find('select option:selected').each(function () {
        if( $(this).val() == "" ) {
            $(this).addClass('input-error');
            next_step = false;
        }
        else 
        {
            $(this).removeClass('input-error');
        }
    });

12th September, 2018

irankhosravi left a reply on Console.log Not Working • 1 week ago

@cmdobueno

No, I haven't other javascript errors?

irankhosravi started a new conversation Console.log Not Working • 1 week ago

My id form is communicated-teachers-forms:

<form id="communicated-teachers-forms" method="post">

My id submit is save-communicated-teachers:

<button id="save-communicated-teachers" type="submit" class="btn btn-success pull-left col-md-4 btn-lg">

My ajax is

$("#communicated-teachers-forms").submit(function (event) {
            event.preventDefault();
            console.log('test');

I tried for display But it do not display. for example test. I do not know other.

What should I do?

9th September, 2018

irankhosravi left a reply on Trying To Get Property Of Non-object • 2 weeks ago

@tykus

Thanks ..............................

irankhosravi left a reply on Trying To Get Property Of Non-object • 2 weeks ago

Thank for answer. But what is this error

Property [cluster_name] does not exist on this collection instance.

I changed in my model from hasMany to belongsTo

return $this->belongsTo(Cluster::class, 'cluster_id');

irankhosravi started a new conversation Trying To Get Property Of Non-object • 2 weeks ago

Hi friends, I tried display for communicate but I get this error. And communicate save well in database.

My table is schools, activities , clusters

For schools table:

id user_id province_id city_id center_id

For activities id school_id cluster_id

For clusters table

id cluster_name

Trying to get property of non-object.

School.php

public function activities()
{
    return $this->hasMany(Activity::class, 'school_id');
}

Activity.php

public function cluster()
{
    return $this->belongsTo(Cluster::class, 'cluster_id');
}

SchoolController.php

public function index()
{
    $schools = School::with('activities')->latest()->paginate(25);
    return view('Admin.submit-information.all', compact('schools'));
}

What should I do?

Thank you

6th September, 2018

5th September, 2018

irankhosravi left a reply on Define A Variable In Console • 2 weeks ago

If you think I'm rude. I apologize to you. Because I need all of you for help and I have to finish the project.

irankhosravi left a reply on Define A Variable In Console • 2 weeks ago

Does anyone answer my question?

irankhosravi left a reply on Define A Variable In Console • 2 weeks ago

Look , I have a form of teacher

teacher table

  • id
  • teacher_firstname
  • teacher_lastname
  • date_first_coaching_card_teacher
  • degree_education_teacher
  • document_education_teacher
  • mobile_teacher
  • created_at
  • updated_at

And I want when a user save teacher_firstname, teacher_lastname ,..... a variable in consloe dp define.

irankhosravi left a reply on Define A Variable In Console • 2 weeks ago

Look , I have a form of teacher

teacher table

id teacher_firstname teacher_lastname date_first_coaching_card_teacher degree_education_teacher document_education_teacher mobile_teacher created_at updated_at

irankhosravi left a reply on Define A Variable In Console • 2 weeks ago

Look , I have a form of teacher

teacher table

-id

-teacher_firstname

-teacher_lastname

-date_first_coaching_card_teacher

-degree_education_teacher

-document_education_teacher

-mobile_teacher

-created_at

-updated_at

irankhosravi left a reply on Define A Variable In Console • 2 weeks ago

@click

I deleted my post. You delete your post, please.

irankhosravi left a reply on Define A Variable In Console • 2 weeks ago

Answer

irankhosravi started a new conversation Define A Variable In Console • 2 weeks ago

How to define a variable in console.log in ajax for example:

ajax

4th September, 2018

irankhosravi left a reply on The File "C:\xampp\tmp\php1D5F.tmp" Does Not Exist • 3 weeks ago

What is the solution and how to change it?

irankhosravi left a reply on The File "C:\xampp\tmp\php1D5F.tmp" Does Not Exist • 3 weeks ago

I get this error

Unable to create the "http://localhost:7000/upload/images/2018" directory

This error occured in following lines:

$imagesUrl = $this->uploadImages($request->file('images'));

and

$file = $file->move(url('/upload/images/'.$year) , $filename);

Thanks for answer.

irankhosravi left a reply on The File "C:\xampp\tmp\php1D5F.tmp" Does Not Exist • 3 weeks ago

What should I do?

irankhosravi started a new conversation The File "C:\xampp\tmp\php1D5F.tmp" Does Not Exist • 3 weeks ago

I after install

composer require intervention/image

I want to upload image and after submit a form, I get this error.

The file "C:\xampp\tmp\php1D5F.tmp" does not exist

public function store(ArticleRequest $request)
{
    auth()->loginUsingId(1);
    $imagesUrl = $this->uploadImages($request->file('images'));

    $article = auth()->user()->article()->create(array_merge($request->all(), ['images' => $imagesUrl]));
    $article->categories()->attach(request('category'));


    return redirect(route('articles.index'));
}

protected function uploadImages($file)
{
    $year = Carbon::now()->year;
    $imagePath = "/upload/images/{$year}/";
    $filename = $file->getClientOriginalName();

    $file = $file->move(public_path($imagePath) , $filename);

    $sizes = ["300" , "600" , "900"];
    $url['images'] = $this->resize($file->getRealPath() , $sizes , $imagePath , $filename);
    $url['thumb'] = $url['images'][$sizes[0]];

    return $url;
}

private function resize($path , $sizes , $imagePath , $filename)
{
    $images['original'] = $imagePath . $filename;
    foreach ($sizes as $size) {
        $images[$size] = $imagePath . "{$size}_" . $filename;

        Image::make($path)->resize($size, null, function ($constraint) {
            $constraint->aspectRatio();
        })->save(public_path($images[$size]));
    }

    return $images;
}

I tried Change the code:

    $imagesUrl = $this->uploadImages($request->file('images'));
    return $imagesUrl;

It displaied return $imagesUrl well.

images  
300 "/upload/images/2018/300_tvto.jpg"
600 "/upload/images/2018/600_tvto.jpg"
900 "/upload/images/2018/900_tvto.jpg"
original    "/upload/images/2018/tvto.jpg"
thumb   "/upload/images/2018/300_tvto.jpg"

I think problem from array_merge

So what's the solution?

3rd September, 2018

irankhosravi left a reply on How To Update Radio Button Value In Laravel With Ajax? • 3 weeks ago

I changed with following line. But that did not happen what I wanted.

teacher_type = ($("#teacher_type").prop("checked") == true ? '1' : '0');
Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.