copain

copain

Member Since 1 Year Ago

Experience Points 2,660
Experience Level 1

2,340 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 16
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.

08 Aug
1 year ago

copain started a new conversation Notification Using Ajax.

Hello i have a Laravel project and i'm looking for easy way to create notification, in my project i have announcement table and i want all user will see notification every-time there is new announcement. is it possible? without using pusher or echo? can AJAX make this possible? if you have any idea or link for tutorial i would appreciate thanks in advance.

06 Aug
1 year ago

copain started a new conversation How To Redirect Notification To Post_id

Hello i'm trying to create notification everytime there is a new post ,when they click one of the notification link it will re direct to the post and show the post, is it possible without using vue.js

here is my code;

Controller:
  public function readbyid(Notification $notification){

 Auth::user()->unreadnotifications()->find($request->id)->markAsRead();
        return redirect()->back();
}


Route:

Route::get('markread/{notification}', '[email protected]' ); 


View Blade:

 @foreach(auth()->user()->unreadnotifications as $notify)
                    <li><a rel="nofollow" href="{{Url('notification/')}}" class="dropdown-item d-flex"> 
                    
                        <div class="msg-body">
                        <h3 class="h5">{{$notify->data['title']}}</h3>
                        </div> </a></li>@endforeach

right now with my code i cannot view the post,

11 Jul
1 year ago

copain started a new conversation Editing Data Table In Laravel Confuse

i have this data-table in my project, now i want to perform update/edit in my table is it necessary to use java-script or any data-grid plugin in order for me to edit my table? or i can simple just use input html and pass it to my controller is it possible? cos i'm a little bit confuse..if im wrong please point me to a better solution if could provide link tutorial that would be awesome. attached link to my question in stackoverflow

https://stackoverflow.com/questions/51296406/editing-data-table-in-laravel-confuse

03 Jul
1 year ago

copain left a reply on Laravel 5.5 Pagination For Bootstrap 4

@roddyp youre answer works thank you... i was using bootstrap 3 in laravel but when i shifted to bootstrap 4 pagination come out ugly then i came across with your'e answer then it works hehe Thank you..

27 Jun
1 year ago

copain left a reply on Foreach Loop To Array

@BishoyWagih this is working but problem is i'm getting null value.

copain left a reply on Foreach Loop To Array

@BishoyWagih will i still follow my previous code or just simply replace it with your code?

copain started a new conversation Foreach Loop To Array

with my current code i can only store 1 value at a time is there anyway that i could make this array? i use for-each loop hoping it will loop all the value and send it as array, but not working can anyone point me to a Laravel tutorial discussing on how to perform loop to array..

Note: my model Score has foreign key which is [Lead_id and Subject_id]

Controller code:

 public function store(Request $request)
{
$data = $request->all();

        $leads = $data['Lead_id'];
    
        $subject_ids = $data['Subject_id'];
    
        foreach($leads as $key => $input) {

        $scores = new Score();
        $scores->Subject_id = isset($subject_ids[$key]) ?  $subject_ids[$key] : ''; 
        $scores->Lead_id = isset($leads[$key]) ? $leads[$key] : ''; 
        $scores->save();
      }
}
13 Jun
1 year ago

copain left a reply on How To Perform Simple Audit Trail In Simple CRUD Laravel

@bobbybouwmann thanks for you're answer man, i have found a package in laravel named LARAVEL-AUDIT and this is what i was looking for full package of audit trail easy to use hehe but anyways thank you appreciate you're answer..

copain started a new conversation How To Perform Simple Audit Trail In Simple CRUD Laravel

how to get the username of the last person who update the form,using the (updated_at) timestamp in laravel and what is the best logic or approach to do?is it possible to use in blade only? or should i need to put the code in my controller?

Example: Updated:13-Jun-2018 UpdatedBy: Username

currently i can only get the updated date by using this code in my blade

Updated:{{ date('d-M-Y', strtotime($leads->updated_at))}}
09 Jun
1 year ago

copain left a reply on Date Search In Laravel 5.5

@bobbybouwmann @Cronix if i use the parseFromFormat it Doesn't work its showing timezone problem. But when i use Parse and removed the 'y-d-m' it worked but when i run search again in may, april will show on the last page haha but when i search other month it works no issue.. mybe my may data is a bit problem haha but anyways thanks man ill just have to delete my may data and see if it works hehe only May data having issue the rest are okay.. hehe

copain left a reply on Date Search In Laravel 5.5

@bobbybouwmann i used your'e suggested code it only works if i remove the 'Y-m-d' but i ran into another problem if i search (From May 1 To May31) April also come out in the table haha

08 Jun
1 year ago

copain started a new conversation Date Search In Laravel 5.5

i have a table with 3 search functions, [1.search box, 2.drop-down 3. date-picker] now i'm having problem with (date-picker) how do i make it work inside my controller i want to have like Date_From and Date_To so i can filter the date, but in my DB i only have the default timestamp which is the created_at column is it possible to use it? and how?

Note: Search box and drop down search is working fine with this code, all i need is the code for date search and where to put it inside my controller and blade.

CONTROLLER:


 public function index(Request $request)
    {
     
        $search=$request->input('search'); 
      

        if(request()->has('lead_status')){
            $leads=Lead::where('lead_status', request('lead_status'))
            ->paginate(5)
            ->appends('lead_status',request('lead_status'));
        }
    
        else{

            $leads=Lead::orderBy('created_at','desc')->search($search)->paginate(5);
      
        }

        return  view ('leads.index')->with('leads',$leads);
    
    }



View.Blade


<form action="{{route('leads.index')}}" method="get" class="form-inline" >
 <!--Start Search Box -->
    <div class="form-group">

    <input type="text" name="search" class="form-controll" placeholder="Enter Name" value=" 
    {{isset($search) ? $search : ''}}" style="text-transform:uppercase;" >

    </div>

    <div class="form-group">

    <button type="submit"><i class="fa fa-search"></i></button>

    </div>
    <!--End Search Box -->

     <!--Start Drop Down Filter -->

    <div class="form-group">
     <div class="dropdown">
        <button class="dropbtn">Select Status <i class="fa fa-caret-down"></i></button>
          <div class="dropdown-content">
          <a href="/leads?lead_status=enrolled">ENROLLED</a>
          <a href="/leads?lead_status=pending">PENDING</a>
          <a href="/leads?lead_status=cancel">CANCEL</a>
           
      </div>
   </div>

    <!--End Drop Down Filter -->

  <!--Start Date Picker-->


<div class="form-group">
   <label>FROM</label>
   <input type="date"  name="from" value="" class="form-control" >

    <label>TO</label>
   <input type="date"  name="to" value="" class="form-control" >

   <div class="form-group">
    <button type="submit"><i class="fa fa-search"></i></button>
    </div>                   
   </div>

  <!--End Date Picker-->



    </form>
09 Apr
1 year ago

copain started a new conversation Customizing Reset Password For Laravel

Hello, any tutorial Link on how to create custom password reset in Laravel? i want to have a reset password on my web application but i don't want to use the email reset. is it possible?

i want something like this:

Username:
NewPassword:
ConfirmPassword:
25 Mar
1 year ago

copain started a new conversation Loop And Array In La-ravel

I have a student registration form, when you enroll your'e child you fill up the form then inside the form has information about the father like name, occupation,email and etc.. then inside the form also you can put your'e child's name, age gender etc .. now if you have multiple child you can click the + button to add another row for the second child then once you submit the form the two child you key-in will have the same father's information.

Question: how do i construct it into my Controller? and how do i loop the parent's information. Currently with my code i can only save array of child information i can't loop the father's information in each child.

Controller:

 public function store(Request $request)
    {
    //dd($request->all());
    
                $this->validate($request, [
                     'student_name.*'=>'required|max:50',
                      'age.*'=>'required|integer',
                   //Roles Goes Here 
                 ]);
                 
                 $input = $request->all();

                 if (count($input['student_name']) > 0) {
                     for ($i = 0 ; $i < count($input['student_name'])  ; $i++) {
                            $leads = new Lead();
         
                           $leads->student_name = $input['student_name'][$i];
                           $leads->gender =  $input['gender'][$i];
                           $leads->age = $input['age'][$i];

                           $leads->father_name=$request->father_name;
                           $leads->father_contact1=$request->father_contact1;
                           $leads->father_email=$request->father_email;
                           $leads->father_occupation=$request->father_occupation;
                           $leads->father_religion=$request->father_religion;
                           
                           $leads->save();
                     }
                 
}

VIEW

<form action="{{route('leads.store')}}" method="POST">
    {{csrf_field()}}
    
    <div class="col-sm-12">
    <h3 class="well">Parent's Information</h3>
    <div class="row">
        

        <div class="col-sm-4 form-group">
        <label>FATHER'S NAME</label>                    
        <input class="form-control" id="txtuppercase1"  type="text" name="father_name" value="{{old('father_name')}}" placeholder="Enter FATHER NAME.." >                       
        </div>

        <div class="col-sm-4 form-group">
        <label>CONTACT</label>
        <input type="text" id="txtuppercase2"   name="father_contact1" value="{{old('father_contact1')}}" placeholder="Enter CONTACT.." class="form-control"  >
        </div>
        <div class="col-sm-4 form-group">

        <label>EMAIL ADDRESS</label>
        <input type="text"    name="father_email" value="{{old('father_email')}}" placeholder="Enter EMAIL ADDRESS.." class="form-control"  >
        </div>

        <div class="col-sm-4 form-group">
        <label>OCCUPATION</label>
        <input type="text"   name="father_occupation" value="{{old('father_occupation')}}" placeholder="Enter OCCUPATION.." class="form-control"  >
        </div>

        <div class="col-sm-4 form-group">
        <label>RELIGION</label>
        <input type="text"   name="father_religion" value="{{old('father_religion')}}" placeholder="Enter RELIGION.." class="form-control"  >
        </div>

    </div>
    <br>
    <div class="row">
        <div class="col-md-12">
            <div data-role="dynamic-fields">
                <div class="form-inline">
                    <div class="form-group">
                        <label class="sr-only" for="student_name">NAME</label>
                        <input type="text" class="form-control" id="student_name"  name="student_name[]" placeholder="STUDENT NAME">
                    </div>
                    <span>-</span>
                    <div class="form-group">
                        <label class="sr-only" for="age">AGE</label>
                        <input type="text" class="form-control" id="age"  name="age[]" placeholder="AGE">
                    </div>
                    <span>-</span>
                    
                    <div class="form-group">
                        
                        <label class="sr-only" for="gender">GENDER</label>
                        <input type="text" class="form-control" id="gender"  name="gender[]" placeholder="GENDER">
                    </div>
                    <span>-</span>
                    
                    <div class="form-group">
                        
                        <label class="sr-only" for="school">SCHOOL</label>
                        <input type="text" class="form-control" id="last_school_attended"  name="last_school_attended[]" placeholder="SCHOOL">
                    </div>
                    <button class="btn btn-danger" data-role="remove">
                        <span class="glyphicon glyphicon-remove"></span>
                    </button>
                    <button class="btn btn-primary" data-role="add">
                        <span class="glyphicon glyphicon-plus"></span>
                    </button>
                </div>  <!-- /div.form-inline -->
            </div>  <!-- /div[data-role="dynamic-fields"] -->
        </div>  <!-- /div.col-md-12 -->
    </div>  <!-- /div.row -->

      <br>    
<div>
<button type="submit" class="btn btn-success">SUBMIT</button>
<a href="{{route('leads.index')}}" class="btn btn-success">CANCEL</a>
</div>
 </form>
22 Mar
1 year ago

copain left a reply on How To Execute Loop With Array

@Snapey im getting error

Invalid argument supplied for foreach()

copain left a reply on How To Execute Loop With Array

@Snapey no need for relationship, cos it stays in single table only, this is a student registration form when you enroll your'e child you fill up the form then inside the form has information about the father like name, occupation,email and etc.. then inside the form also you can put your'e child's name, age gender etc .. now if you have multiple child you can click the + button to add another row for the second child then once you submit the form the two child you key in has the same father's information.

copain left a reply on How To Execute Loop With Array

@Snapey What do u need?

copain left a reply on How To Execute Loop With Array

@Snapey can do a sample base on my controller above?

copain started a new conversation How To Execute Loop With Array

i have a form where you enter the parent information together with the child information now how do i save if one parent with multiple child.

Example:

FATHER (A) has child1,child2,child3 how do i loop this,

CONTROLLER:

public function store(Request $request)
    {
     
    
                $this->validate($request, [
                     'student_name.*'=>'required|max:50',
                      'age.*'=>'required|integer',
                  
                 ]);

                           /*$leads = new Lead();
                           
                           $leads->save();*/
               


                 $input = $request->all();

                 if (count($input['student_name']) > 0) {
                     for ($i = 0 ; $i < count($input['student_name'])  ; $i++) {
                           $leads = new Lead();
                           $leads->student_name = $input['student_name'][$i];
                           $leads->gender =  $input['gender'][$i];
                           $leads->age = $input['age'][$i];
                           $leads->last_school_attended = $input['last_school_attended'][$i];

                           $leads->father_name=$request->father_name;
                           $leads->father_contact1=$request->father_contact1;
                           $leads->father_email=$request->father_email;
                           $leads->father_occupation=$request->father_occupation;
                           $leads->father_religion=$request->father_religion;

                           $leads->save();
                     }
                 }
                
                

                //Display a successful message upon save
                return redirect()->route('leads.index')
            ->with('flash_message', 'Success.');
    }

VIEW:

<form action="{{route('leads.store')}}" method="POST">
    {{csrf_field()}}
    
    <div class="col-sm-12">
    <h3 class="well">Parent's Information</h3>
    <div class="row">
        

        <div class="col-sm-4 form-group">
        <label>FATHER'S NAME</label>                    
        <input class="form-control" id="txtuppercase1"  type="text" name="father_name" value="{{old('father_name')}}" placeholder="Enter FATHER NAME.." >                       
        </div>

        <div class="col-sm-4 form-group">
        <label>CONTACT</label>
        <input type="text" id="txtuppercase2"   name="father_contact1" value="{{old('father_contact1')}}" placeholder="Enter CONTACT.." class="form-control"  >
        </div>
        <div class="col-sm-4 form-group">

        <label>EMAIL ADDRESS</label>
        <input type="text"    name="father_email" value="{{old('father_email')}}" placeholder="Enter EMAIL ADDRESS.." class="form-control"  >
        </div>

        <div class="col-sm-4 form-group">
        <label>OCCUPATION</label>
        <input type="text"   name="father_occupation" value="{{old('father_occupation')}}" placeholder="Enter OCCUPATION.." class="form-control"  >
        </div>

        <div class="col-sm-4 form-group">
        <label>RELIGION</label>
        <input type="text"   name="father_religion" value="{{old('father_religion')}}" placeholder="Enter RELIGION.." class="form-control"  >
        </div>

    </div>
    <br>
    <div class="row">
        <div class="col-md-12">
            <div data-role="dynamic-fields">
                <div class="form-inline">
                    <div class="form-group">
                        <label class="sr-only" for="student_name">NAME</label>
                        <input type="text" class="form-control" id="student_name"  name="student_name[]" placeholder="STUDENT NAME">
                    </div>
                    <span>-</span>
                    <div class="form-group">
                        <label class="sr-only" for="age">AGE</label>
                        <input type="text" class="form-control" id="age"  name="age[]" placeholder="AGE">
                    </div>
                    <span>-</span>
                    
                    <div class="form-group">
                        
                        <label class="sr-only" for="gender">GENDER</label>
                        <input type="text" class="form-control" id="gender"  name="gender[]" placeholder="GENDER">
                    </div>
                    <span>-</span>
                    
                    <div class="form-group">
                        
                        <label class="sr-only" for="school">SCHOOL</label>
                        <input type="text" class="form-control" id="last_school_attended"  name="last_school_attended[]" placeholder="SCHOOL">
                    </div>
                    <button class="btn btn-danger" data-role="remove">
                        <span class="glyphicon glyphicon-remove"></span>
                    </button>
                    <button class="btn btn-primary" data-role="add">
                        <span class="glyphicon glyphicon-plus"></span>
                    </button>
                </div>  <!-- /div.form-inline -->
            </div>  <!-- /div[data-role="dynamic-fields"] -->
        </div>  <!-- /div.col-md-12 -->
    </div>  <!-- /div.row -->

      <br>    
<div>
<button type="submit" class="btn btn-success">SUBMIT</button>
<a href="{{route('leads.index')}}" class="btn btn-success">CANCEL</a>
</div>
 </form>


21 Mar
1 year ago

copain left a reply on Save Value Of An Array

@zymawy thanks bro, it works .

copain left a reply on Save Value Of An Array

@Dry7 if i delete validation how do i required the field

copain left a reply on Save Value Of An Array

@Dry7 so i don't need to touch my controller? getting errors when i use ur suggested code.

htmlspecialchars() expects parameter 1 to be string, array given (View: C:\wamp64\www\GraceProject\ROLEwithPERMISSION\resources\views\leads\index.blade.php)

copain started a new conversation Save Value Of An Array

how do i save the value of array into my controller?

result of array using DD

  dd($request->all());

array:4 [▼
  "_token" => "kjYvkKfuOkiBacn1EC0EzfeK5AitRYbXADE2E5RI"
  "student_name" => array:3 [▼
    0 => "ROBERT"
    1 => "cindy"
    2 => "rico"
  ]
  "age" => array:3 [▼
    0 => "12"
    1 => "13"
    2 => "14"
  ]
  "gender" => array:3 [▼
    0 => "MALE"
    1 => "female"
    2 => "MALE"
  ]
]

CONTROLLER:

public function store(Request $request)
    {
     dd($request->all());
    
        $this->validate($request, [
         
          'student_name'=>'required|max:50',
            
            
                ]);
               
           
                
                        $leads=new Lead();
                        $leads->student_name = $request->student_name;
                       $leads->gender = $request->gender;
                       $leads->age = $request->age;
                       $leads->save();
                    
                
                

                //Display a successful message upon save
                return redirect()->route('leads.index')
            ->with('flash_message', 'Success.');
    }

HERE'S my VIEW

 <form action="{{route('leads.store')}}" method="POST">
    {{csrf_field()}}
    
    <div class="col-sm-12">
    
    
    <div class="container">
    <div class="row">
        <div class="col-md-12">
            <div data-role="dynamic-fields">
                <div class="form-inline">
                    <div class="form-group">
                        <label class="sr-only" for="field-name">Field Name</label>
                        <input type="text" class="form-control" id="field-name"  name="student_name[]" placeholder="Field Name">
                    </div>
                    <span>-</span>
                    <div class="form-group">
                        <label class="sr-only" for="field-value">Field Value</label>
                        <input type="text" class="form-control" id="field-value"  name="age[]" placeholder="Field Value">
                    </div>
                    <div class="form-group">
                        <label class="sr-only" for="field-agent">Field Agent</label>
                        <input type="text" class="form-control" id="field-agent"  name="gender[]" placeholder="Field Agent">
                    </div>
                    <button class="btn btn-danger" data-role="remove">
                        <span class="glyphicon glyphicon-remove"></span>
                    </button>
                    <button class="btn btn-primary" data-role="add">
                        <span class="glyphicon glyphicon-plus"></span>
                    </button>
                </div>  <!-- /div.form-inline -->
            </div>  <!-- /div[data-role="dynamic-fields"] -->
        </div>  <!-- /div.col-md-12 -->
    </div>  <!-- /div.row -->
</div>
          
<div>
<button type="submit" class="btn btn-success">SUBMIT</button>
<a href="{{route('leads.index')}}" class="btn btn-success">CANCEL</a>
</div>
 </form>


<!--end of container-->
 </div>
 </div>

20 Mar
1 year ago

copain left a reply on How Do I Save Multiple Value Of A Fillable Table Into My Database

@vmitchell85 bro its not working, here is the update code.

CONTROLLER:

public function store(Request $request)
    {
        $this->validate($request, [
         
        
            
            'student_name'=>'required|max:50|unique:leads,student_name',
            
            
                ]);
               
                foreach($request->all() as $leads => $value) {
                    if (starts_with('name', $leads)) {
                        $number = str_after('name', $leads);
                
                        $leads=new Lead();
                        $leads->student_name = $request->input('name' . $number);
                        $leads->gender = $request->input('gender' . $number);
                        $leads->age = $request->input('age' . $number);
                        $leads->save();
                    }
                }
              

                //Display a successful message upon save
                  return redirect()->route('leads.create')
                      ->with('flash_message', 'Success.');
    }



VIEW


<div class="row">
    <form action="{{route('leads.store')}}" method="POST">
    {{csrf_field()}}
    
    <div class="col-sm-12">
    
    
<div class="row clearfix">
        <div class="col-md-12 column">
            <table class="table table-bordered table-hover" id="tab_logic">
                <thead>
                    <tr >
                        <th class="text-center">
                            #
                        </th>
                        <th class="text-center">
                            STUDENT NAME
                        </th>
                        <th class="text-center">
                            GENDER
                        </th>
                        <th class="text-center">
                            AGE
                        </th>
                        <th class="text-center">
                            SCHOOL
                        </th>
                        
                    </tr>
                </thead>
                <tbody>
                
                    <tr id='addr0'>
                        <td>
                        1
                        </td>
                        <td>
                        <input type="text" name='student_name0' value="{{old('student_name')}}" placeholder='STUDENT NAME' class="form-control"/>
                        </td>
                        <td>
                        <input type="text" name='gender0' placeholder='GENDER' class="form-control"/>
                        </td>
                        <td>
                        <input type="text" name='age0'  placeholder='AGE' class="form-control"/>
                        </td>
                        <td>
                        <input type="text" name='school0' placeholder='SCHOOL' class="form-control"/>
                        </td>
                    </tr>
                    
                    <tr id='addr1'></tr>
                </tbody>
            </table>
        </div>
    </div>
    <a id="add_row" class="btn btn-default pull-left">Add Row</a><a id='delete_row' class="pull-right btn btn-default">Delete Row</a>
    
          
<div>
<button type="submit" class="btn btn-success">SUBMIT</button>
<a href="{{route('leads.index')}}" class="btn btn-success">CANCEL</a>
</div>
    </form>


<!--end of container-->
 </div>
 </div>

copain started a new conversation How Do I Save Multiple Value Of A Fillable Table Into My Database

i have a fallible table and i want to save the value of the table into my database but i don't know to loop it any idea how?

Controller:

public function store(Request $request)
{
    $this->validate($request, [

        'student_name'=>'required|max:50|unique:leads,student_name',
        'gender'=>'required|max:50',
        'age'=>'required|max:2',



            ]);

            $leads=new Lead();
            $leads->student_name = $request->student_name;
            $leads->gender = $request->gender;
            $leads->age = $request->age;
            $leads->save();

            //Display a successful message upon save
              return redirect()->route('leads.create')
                  ->with('flash_message', 'Success.');
}

CREATE.BLADE

<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <table class="table table-bordered table-hover" id="tab_logic">
                <thead>
                    <tr >
                        <th class="text-center">
                            #
                        </th>
                        <th class="text-center">
                            StudentName
                        </th>
                        <th class="text-center">
                            Gender
                        </th>
                        <th class="text-center">
                            Age
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <tr id='addr0'>
                        <td>
                        1
                        </td>
                        <td>
                        <input type="text" name='student_name'  placeholder='StudentName' class="form-control"/>
                        </td>
                        <td>
                        <input type="text" name='gender' placeholder='Gender' class="form-control"/>
                        </td>
                        <td>
                        <input type="text" name='age' placeholder='AGE' class="form-control"/>
                        </td>
                    </tr>
                    <tr id='addr1'></tr>
                </tbody>
            </table>
        </div>
    </div>
    <a id="add_row" class="btn btn-default pull-left">Add Row</a><a id='delete_row' class="pull-right btn btn-default">Delete Row</a>
</div>

16 Mar
1 year ago

copain started a new conversation How To Avoid Url Address Manipulation

in laravel how do i stop my url address from showing data everytime i changed the id example below.

Example: http://localhost:8000/posts/11 --DEFAULT

If they change the id like the example below it will return to the DEFAULT or go to forbidden page. http://localhost:8000/posts/12

http://localhost:8000/posts/13

http://localhost:8000/posts/14

copain left a reply on Report Designer For Laravel 5.5

@xmarks yes i want to generate report Example: Employee Information in one A4page like resume where you can see all the information of one particular person..

copain left a reply on Auto Increment Integer

@jessica thank you..

15 Mar
1 year ago

copain started a new conversation Report Designer For Laravel 5.5

Hello, any suggestion or available link tutorial for how to make or design report in Laravel 5.5 i'm new in programming hope that you could point me into right direction. i wanna know how to make it. thanks in advance..

14 Mar
1 year ago

copain started a new conversation Auto Increment Integer

i'm trying to make integer as auto increment and want to start in 100, but error keep coming up..

SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and i
 t must be defined as a key

My code:

   public function up()
    {
        Schema::create('leads', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('generate_id');
            $table->string('name')->nullable();
            $table->string('office_number')->nullable();
            $table->string('father_email')->nullable();
            $table->string('father_occupation')->nullable();
            $table->string('father_religion')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('leads');
    }
}

13 Mar
1 year ago

copain left a reply on Auto Increment String

@snapey @Cronix @jlrdw thanks guys your idea and opinions helped me understand how make it more easy and simple without scratching my head :D

copain left a reply on Auto Increment String

@Cronix your code shall i put it on the controller or in the view.blade?

this is my code in controller

public function store(Request $request)
{
    //
    $this->validate($request, [


           'generate_id'=>'required|Unique',


            ]);
            $leads=new lead();
            $leads->generate_id=$request->generate_id;
            $leads->name=$request->name;
            $leads->save();

            return redirect()->route('leads.index')
        ->with('flash_message', 'Success.');
}

copain left a reply on Auto Increment String

@Cronix i want something like AAA001,AAA002,AAA003 is it posible?

copain started a new conversation Auto Increment String

how do i create auto increment string in laravel and store it into mysql database? something like this? TEST001,TEST002,TEST003,TEST004,.....TEST001,

MIGRATION TABLE.

 public function up()`

{
    Schema::create('leads', function (Blueprint $table) {
        $table->increments('id');
        $table->string('generate_id');
        $table->string('name')->nullable();
        $table->timestamps();
    });
}```



CONTROLLER:


```public function store(Request $request)
{
    //
    $this->validate($request, [


           'generate_id'=>'required|Unique',


            ]);
            $leads=new lead();
            $leads->generate_id=$request->generate_id;
            $leads->name=$request->name;
            $leads->save();

            return redirect()->route('leads.index')
        ->with('flash_message', 'Success.');
}

29 Dec
1 year ago

copain started a new conversation Auto Checked Checkbox Value Using Vue.js

On my edit page I'm trying to make my checkbox auto checked based on the permissions that I already assigned to my roles, I don't know how to make it work. Any idea? Currently with my code I'm getting unchecked checkbox with the list of all my permissions

Edit.blade

@foreach ($permissions as $permission) {{$permission->display_name}} @endforeach

var app = new Vue({ el: '#app', data: { permissionsSelected: [] } });

19 Dec
1 year ago

copain started a new conversation Checkbox Won't Show Using Buefy In Laravel

Hello, i have been trying to display a check box but i couldn't get it to display, I've tried some of the tutorials and read other forum but still couldn't make it to work, if anyone could guide me to the proper way on how to make (buefy+bulma ) Checkbox work, i would appreciate your help. i'm only trying to display simple check box. below are the following materials i have.

1.#App.js

require('./bootstrap');

window.Vue = require('vue');

import Vue from 'vue' import Buefy from 'buefy' import 'buefy/lib/buefy.css'

Vue.use(Buefy)

const app = new Vue({ el: '#app' });

2.# index.blade.php

@extends('layouts.appmain')

@section('content')

<div class="column">

<div class="block">
        <b-checkbox v-model="checkboxGroup"
            native-value="test1">
            TEST1
        </b-checkbox>
        <b-checkbox v-model="checkboxGroup"
            native-value="test2">
            TEST2
        </b-checkbox>
        <b-checkbox v-model="checkboxGroup"
            native-value="test3">
            TEST3
        </b-checkbox>
    </div>
  </div>

    <script src="{{ asset('assets/js/app.js') }}"></script>

@endsection