kazemimorteza68@gmail.com

Member Since 1 Year Ago

Experience Points 370
Experience Level 1

4,630 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 0
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.

16 Feb
1 month ago

[email protected] left a reply on Authentication

@AURAWINDSURFING - Thanks for your reply.but if we sign out from gmail OR recently i worked with yii framework after sign out we can't see dashboard panel.Thanks

[email protected] started a new conversation Authentication

Hi EveryOne. i have a dashboard for web site management.when site managers Exit from dashboard press Exit button the Exit link execute below code


Route::get('/logout', function(){
    //logout user
    auth()->logout();
    // redirect to homepage
    return redirect('/');
});
php

But with browser back page button  can again see dashboard panel .
if they click on link inside dashboard be redirected to login page.Please help me solve this problem.Thanks
22 Jan
1 month ago

[email protected] left a reply on Define One Foreign Key Have Multiple Refrence

@CIPSAS - But inside phpmyadmin we can define this subject.Thanks

[email protected] left a reply on Define One Foreign Key Have Multiple Refrence

@CIPSAS - Than you for reply. but i want create relation.if i delete two line i cannot create relation using Migration.

[email protected] started a new conversation Define One Foreign Key Have Multiple Refrence

Hi. i have three table Posts,Videos and Comments. one of column inside comment table have foreign key role. i want this foreign key have relation with two columns inside post and video.but migration only create one foreign key relation and can't create second relation.

Posts Table:


 Schema::create('posts', function (Blueprint $table) {
            $table->increments('p_id');
            $table->text("title");
            $table->text("body");
            $table->timestamps();
        });

Videos Table:


        Schema::create('videos', function (Blueprint $table) {
            $table->increments('v_id');
            $table->string("url");
            $table->text("title");
            $table->timestamps();
        });

Comments Table:


        Schema::create('comments', function (Blueprint $table) {
            
            $table->increments('c_id');
            $table->text("body");
            $table->integer("commentable_id")->unsigned();
            $table->string("commentable_type");
          $table->foreign('commentable_id')->references('v_id')->on('videos');
          
            $table->foreign('commentable_id')->references('p_id')->on('posts'); //Give Error
            $table->timestamps();
       
        });

when i want define second relation(foreign key) that give error.Please help me

01 Sep
6 months ago

[email protected] left a reply on Disable Laravel Error Reporting

Thanks Dear @hsntngr . i have used your command but Do not work. my problem solved . when i change .env file that is need to stop serve and run again. then error reporting be disable or enable.

[email protected] started a new conversation Disable Laravel Error Reporting

Hi. I want disable laravel error reporting .i use below setting but yet error reporting is enable and show Errors.

.env

APP_DEBUG=false

config>>app.php


'debug' => env('APP_DEBUG', false),

i want to laravel do not show any message even when missing semicolon. Thanks. .

13 Aug
7 months ago

[email protected] started a new conversation Define Rules For Multiple Checkbox

Hi. i want to get and save information using a form . this form have multiple checkbox and i send form data using Ajax.but i cant not define proper rules for checkbox.i get all checkbox that are checked value and create a array and convert theme to string using

JSON.stringify

and send theme for controller But when none of them(checkboxes) Not checked the rule can not send error to form.

this is my form have multiple checkbox:

       <div class="row">

                @foreach($category as $cat)
                    <div class="col-md-3 custom-control custom-checkbox m-2">


                        <input class="custom-control-input" type="checkbox" name="category[]" id="{{$cat->name}}"
                               value="{{$cat->name}}">
                        <label for="{{$cat->name}}" class="custom-control-label">{{$cat->name}}</label>
                    </div>
                @endforeach
            </div>

I get checkbox value using jQuery set them inside a array and send them using Ajax and Json format But:

  

        $(document).ready(function () {



            $("input:submit").click(function (event) {

                event.preventDefault();
                $('#result').text("Processing...!!");
                $.ajaxSetup({
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                    }
                });

                $.ajax({

                    url: "{{url('post/store')}}",
                    method: 'post',
                    dataType: 'json',
                    data: {

                        category:JSON.stringify(getCategory())
                    },
                    success: function (result) {
                        $("#result").text(result['saveState']);

                        $("#result").removeClass("alert-info  alert-danger ");
                        $("#result").addClass("alert alert-success");

                    },  //success
                    error: function (data) {

                      
                        var response = JSON.parse(data.responseText);

                        if (response.errors.category)
                            $("#result").append("<p>" + response.errors.category + "</p>");


                        $("#result").addClass("alert alert-danger")


                    }//error

                });

            });
//--------------------------------------------------


      /**
             * 
             * get checkbox that are selected value and create array
             */
            function getCategory() {


                var category = [];
                $("input[name='category[]']:checked").each(function () {
                    category.push($(this).val());
                })

                    return category;


            }//function category

//--------------------------------------------
        });


controller:


 public function rules()
    {
        return [
            'category' => 'required'

        ];
    }


 public function store(Request $request)
    {
        $validator = \Validator::make($request->all(), $this->rules());
        if ($validator->fails()) {   // ||

            return response()->json(['errors' => $validator->getMessageBag()->toArray()], 400);
        }



            $post = new Post();
            $post->posts_id = rand(1, 10000);
            $post->title = $request->post_title;
            $post->body = $request->post_body;
            $data = json_encode($request->category);
            if ($post->save())
                return response()->json(['saveState' => 'Data is successfully added:']);
            else
                return response()->json(['saveState' => 'error in saving Data']);

    }



31 May
9 months ago

[email protected] left a reply on Getting Data Using Eloquent/one To Many Relationship

unfortunately it give me error:



Route::get('/customer',function(){

    $customers=Customer::with("Country")->get();
    foreach($customers as $customer){

        echo $customer->customer_id."|".$customer->customer_name."|".$customer->country_fid."<br/>";
        foreach($customer->Country as $country){

            echo $country->country->country_name."<br/>";
        }

    }

});

give Error:

``php

ErrorException (E_NOTICE) Trying to get property 'country' of non-object

[email protected] started a new conversation Getting Data Using Eloquent/one To Many Relationship

Hi .

i have two table: 1-country 2-customers

the relationship between two table is one to many. as Example: for one country we have many customers.

Country model:

class Country extends Model
{

    protected $table="country";
    protected $primaryKey="country_id";
    public function customer(){

        //return null;
       return $this->hasMany("App\Customer",'country_fid','country_id');

    }//customer
}


Customer model:


 class Customer extends Model
{
    //
    protected $table="customer";
    protected $primaryKey="customer_id";
 
    public function country(){

        return $this->belongsTo("App\Country",'country_fid','country_id');
    }//country function
}


using below code i can get customers data but i can not get country list related to customer. in fact i want to get name of country related to customer.it only give me customers information:


Route::get('/customer',function(){

    $customers=Customer::with("Country")->get();
    foreach($customers as $customer){

        echo $customer->customer_id."|".$customer->customer_name."|".$customer->country_fid."<br/>";
        foreach($customer->Country as $country){
            echo $country->country_name."<br/>";
        }

    }

});


29 May
9 months ago

[email protected] left a reply on Create Model/migration With Full Permision

thanks friends . i have exited from root access level and now every things is Ok.

[email protected] started a new conversation Create Model/migration With Full Permision

i am on linux-mint .when i create model or migration using php artisan then i can not edit it in my IDE . this is my created file permission: -rw-rw-r-- 1 root root 592 May 29 17:24 2018_05_29_172426_create_country_table.php

is any way to create model or migrations with full permission using terminal? Thanks

05 May
10 months ago

[email protected] left a reply on How To Delete Multiple Records Using Laravel Eloquent

  $id=[4,5,6,7,8,9,10];
$result=myModel::whereIn('id',$id)->delete();
print_r($result);