doproj123

doproj123

Member Since 6 Months Ago

Experience Points
170
Total
Experience

4,830 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-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.

Level 1
170 XP
Nov
08
1 week ago
Activity icon

Replied to Get Value By Model With Relation 'hasMany'

Ok it works but when I printed on view like

{{$artists}}

It looks like this [{"name":Madonna}]

Activity icon

Started a new Conversation Get Value By Model With Relation 'hasMany'

Hello Is have two models which looks like this:

class Producents extends Model{

...

public function artists(){
        return $this->hasMany('App\Artists', 'producer_id', 'producer_id');
    }
...

}
class Artists extends Model{

...

public function producents(){
        return $this->belongsTo('App\Producents', 'producer_id', 'producer_id');
    }
...

}

How I can get sum of artists which have same Producents? I tried something like this in my controller

class ProducentsController extends Controller{

public function show($id)
{
    $producent = Producents::find($id);
    return view('producents.show')->with('producent', $producent);
}

}

And in my view trying something like this

{{$producent->artists->name}}

But it not works. Is it even possible?

Oct
29
3 weeks ago
Activity icon

Replied to Create Very Implicated Validation

work wonderful

Oct
25
3 weeks ago
Activity icon

Started a new Conversation Create Very Implicated Validation

How create validate for form which looking something like this: If user select 'old car' radio button option he need select car name from dropdown select list and then he doesn't have to complete the remaining fields. If user select 'new car' radio button option he must insert name of car and number. If the car doesn't have number user need select checkbox 'car without number' and then he will only have to enter the new car name. Right now it's not work as I would like. View:

<form action="/action.php">
  <label for="exampleFormControlFile1">Cars:</label><br>
  <div id="option" role="radiogroup">          
  <input id="opt" type="radio" class="form-control form-control-sm" value="old" name="car" checked>Old car                  
 <input id="opt" type="radio" class="form-control form-control-sm" value="new" name="car">New car                  
 </div>
<div id="old_car">
{!! Form::select('car', $cars, null, ['class'=>'form-control form-control-sm form-control-chosen', 'placeholder' => 'Choose']) !!}
{!! $errors->first('bu', '<strong><p style="color:red;" class="help-block">:message</p></strong>') !!}
</div>
<div id="new_car">
<label for="exampleFormControlFile1">Car:</label><br>
<input class="form-control form-control-sm" name="name" type="text"><br>
<label for="exampleFormControlFile1">Car number:</label><br>
<input class="form-control form-control-sm" type="text" name="car_number" id="number"><br> 
{!! Form::checkbox('no_number', null, false,  ['class'=>'form-check-input', 'id'=>'car']); !!}
<label class="form-check-label" for="defaultCheck1">car without number</label>                
</div>              
<input type="submit" value="Submit">
</form>

controller

class CarController
...

public function store(Request $request)
{
      $request->validate([            
            'car' => ['required_if:car,old', 'integer'],
            'name' => ['required_if:car,new', 'string'],
            'car_number' => ['required_if:car,new', 'required_without:no_number', 'unique:cars,c_number', 'digits_between:10,10'],

}

Is there a possibility to create validation something like this: IF is selected radio button old car cheking ONLY dropdown select list it is not empty. IF is selected radio button new car checking ONLY fields name and car number AND IF additionally is selected checkbox 'car without number' then check only field name?