Laravel Code

Laravel Implode and Explode Function



We will use implode() function in laravel and show the list of subject. Store pick contain the subject detail based on designation table.

public function application(){
 if(Auth::user()){
    $applData = \App\OfficerExamApplication::where('REGISTRATION_ID','=',Auth::user()->id)->first();
    $subject_id = explode(',' , $applData->subject_type);
    $subjects = \App\Storepick::where('STORE_ID', $applData->DESIGNATION)->whereIn('PICK_ID', $subject_id)->select('PICK_TEXT')->get();
    //dd($subjects);
    $userData = \App\OfficerExamUserMaster::where('REGISTRATION_ID','=',Auth::user()->id)->first();
    return view('admin/application-preview')->with(compact('applData','userData', 'subjects'));
   }else{
    abort(404,'Something went Wrong');
   }
  }


   <tr>
     <td align="left" valign="middle">பயன்பாட்டு பொருள்  /<br/>  Applied Subject </td>
     <td align="left" valign="middle" colspan="2">&nbsp;&nbsp;
     <ul>
       @foreach($subjects as $subject)
             <li>{{$subject->PICK_TEXT}}</li>
       @endforeach
     </ul>
     </td>
    </tr>



Laravel Functional Join Example


$studentData = \App\StudentPapperMapping::join('student_exam_details as se',function($join){
 $join->on('student_pappermapping.student_exam_details_id','=','se.id');
 $join->where('se.class_id','=',Input::get('class_id'));
 $join->where('se.sess_id','=',Session::get('sess_id'));
 $join->where('se.exam_type','=',Input::get('exam_type'));
 $join->where('se.verified_status','=','1');
 $join->where('se.form_status','=','55');
 $join->whereNull('se.deleted_at');
})->join('student_details as stu',function($join){
 $join->on('stu.id','=','se.student_id');
 $join->where('stu.school_id','=',Input::get('school_id'));
 $join->whereNull('stu.deleted_at');
})->join('subject_master as sub',function($join){
 $join->on('sub.id','=','student_pappermapping.subject_id');
 $join->where('sub.paper_type','=',Input::get('paper_type'));
 $join->where('sub.status','=','1');
 $join->whereNull('stu.deleted_at');
})->where('student_pappermapping.subject_id','=',Input::get('subject_id'))
->whereNull('student_pappermapping.deleted_at')
->orderBy('se.roll_no','ASC')->get();



Laravel Validation Form Example :


<div style="background-color:white">
  <h2>Laravel Form Validation Example</h2>
  <form method="POST" action="/form-validation" autocomplete="off">
    @if(count($errors))
      <div class="alert alert-danger">
        <strong>Whoops!</strong> There were some problems with your input.
        <br/>
        <ul>
          @foreach($errors->all() as $error)
          <li>{{ $error }}</li>
          @endforeach
        </ul>
      </div>
    @endif
    <input type="hidden" name="_token" value="{{ csrf_token() }}">
    <div class="row">
      <div class="col-md-12">
        <div class="form-group {{ $errors->has('firstname') ? 'has-error' : '' }}">
          <label for="firstname">Full Name:</label>
          <input type="text" id="fullname" name="fullname" class="form-control" placeholder="Enter Full Name" value="{{ old('firstname') }}">
          <span class="text-danger">{{ $errors->first('fullname') }}</span>
        </div>
      </div>
    </div>
    <div class="row">
      <div class="col-md-12">
        <div class="form-group {{ $errors->has('emailid') ? 'has-error' : '' }}">
          <label for="emailid">Email ID:</label>
          <input type="text" id="emailid" name="emailid" class="form-control" placeholder="Enter Email ID" value="{{ old('emailid') }}">
          <span class="text-danger">{{ $errors->first('emailid') }}</span>
        </div>
      </div>
    </div>
    <div class="row">
      <div class="col-md-12">
        <div class="form-group {{ $errors->has('mobileno') ? 'has-error' : '' }}">
          <label for="mobileno">Mobile No:</label>
          <input type="text" id="mobileno" name="mobileno" class="form-control" placeholder="Enter Mobile No" value="{{ old('mobileno') }}">
          <span class="text-danger">{{ $errors->first('mobileno') }}</span>
        </div>
      </div>
    </div>
    <div class="row">
      <div class="col-md-6">
        <div class="form-group {{ $errors->has('password') ? 'has-error' : '' }}">
          <label for="password">Password:</label>
          <input type="password" id="password" name="password" class="form-control" placeholder="Enter Password" >
          <span class="text-danger">{{ $errors->first('password') }}</span>
        </div>
      </div>
      <div class="col-md-6">
        <div class="form-group {{ $errors->has('confirmpassword') ? 'has-error' : '' }}">
          <label for="confirmpassword">Confirm Password:</label>
          <input type="password" id="confirmpassword" name="confirmpassword" class="form-control" placeholder="Enter Confirm Passowrd">
          <span class="text-danger">{{ $errors->first('confirmpassword') }}</span>
        </div>
      </div>
    </div>
    <div class="form-group">
      <button class="btn btn-success">Submit</button>
    </div>
  </form>
</div>


Git Command for Creating Zip file and all using CMD Prompt 

laravel -> storage
server error -> var/log/httpd/error

zip and upload in live
[root@ip-172-31-13-174 proreport]# unzip vendor.zip
[root@ip-172-31-13-174 proreport]# rm vendor.zip
rm: remove regular file ‘vendor.zip’? y
[root@ip-172-31-13-174 proreport]# chmod 7777 -R vendor
[root@ip-172-31-13-174 proreport]# chmod 7777 -R boot*

zip -r xyz.zip * .[^.]*  // to create the zip file

rm xyz.zip    // to delete the zip file

md5sum xyz.zip   // to create the md5 hash value


----------------------------------------------------------------
[ec2-user@ip-172-31-18-119 ~]$ sudo su
[root@ip-172-31-18-119 ec2-user]# cd /var/app/current                                                                [root@ip-172-31-18-119 current]# chown ec2-user /var/app/current/resources/views                                     /user/application-preview.blade.php
[root@ip-172-31-18-119 current]#

No comments:

Post a Comment

Our Feature Post

There is a tree between houses of A and B If the tree leans on As House

    There is a tree between houses of A and B. If the tree There is a tree between houses of A and B. If the tree leans on A’s House, the t...

Our Popular Post