mardi 30 janvier 2024

Missing required parameter for Route laravel error

Blade.php

<tbody>
foreach ($leave as $model)
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td><div class="btn-group btn-group-sm"><a href=""title="Accept" class="btn btn-info"><i class="fas fa-check"></i></a>
<a href="" title="Reject" class="btn btn-danger"><i class="fas fa-times"></i></a></div></td></tr>
@endforeach
</tbody>

controller

public function LeaveReject($employee_id) {
$leaveApprove = employees_leaves::find($employee_id);
dd($leaveApprove);
$leaveApprove->is_approved = 1;
$leaveApprove->save();
$employeeDetails = EmployeeDetail::where('employee_id', $employee_id)->first();
$employeeDetails->remaining_holiday += 1;
$employeeDetails->save();
session()->flash('error', 'Leave Rejected.');
return redirect()->route('admin.leaveRequests');
}

route

Route::get('/reject/{employee_id}', [App\Http\Controllers\Backend\AdminController::class, 'LeaveReject'])->name('admin.leaveReject');

error - Missing required parameter for [Route: admin.leaveReject] [URI: admin/reject/{employee_id}] [Missing parameter: employee_id].

Hlo guys the above code is regard leave approve and reject.

what i want is on blade.php tag so instead of error need to show employee id and on table i have employee_id but still showing error on view.

if i do here $model->id it's working but i need employee_id instead of the default id.

due to this functionality i can approve and reject leave and manage the leave remaining data.

thanks from advance who will help me.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/KOPUHJM
via IFTTT

dimanche 21 janvier 2024

Uploading images using FancyFileUpload and regular form submit without using Ajax

I like the interface of FancyFileUpload that's why I'm try to implement it on my already existing form submit. The existing form submit works just fine and can save data into database and upload files to the server. (I'm using laravel by the way).

So here's what I'm trying to accomplish. I want users to select files using FancyFileUpload, but I want to submit the form data in a normal way without using ajax or js. The problem is, no files are being uploaded in the server. When FancyFileUpload initialized, it seems the form could not detect any files added by the user, that's why file input shows null. But if I remove FancyFileUpload, the form works just fine.

Here's my form.

<form id="postForm" class="row" action="" method="POST" enctype="multipart/form-data">
@csrf
    <div class="mb-4">
        <div class="mt-3">
            <textarea class="form-control" rows="7" name="body" placeholder="Write something..."></textarea>
        </div>
        
        <div class="mt-3">
            <label class="mb-2">Upload Photos</label>
            <input class="fileUp fileup-sm" type="file" name="photo_list[]" accept="image/png, image/gif, image/jpg, image/jpeg" multiple>
        </div>
    </div>
    <div class="col-sm-12">
        <button type="submit" class="btn btn-primary" id="submitBtn">Submit</button>
    </div>
</form>

Javascript:

 $(document).ready(function() {
        // Initialize FancyFileUpload
        $('.fileUp').FancyFileUpload();

        // Before form submission, reinitialize FancyFileUpload
        $('#postForm').submit(function() {
            $('.fileUp').FancyFileUpload();
        });
    });

No issues on server side because is working just fine if FancyFileUpload is disabled. Thanks a lot in advance.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/oHXehka
via IFTTT

lundi 15 janvier 2024

Laravel 5.8 mail blade with default css styling or inline styling doesn't work

I created mail html blade file designed with css file in Laravel 5.8.

I tried many ways to work the degisned view with css, but nothing actually works.

Sending email is fine, I just changed the whole designed blade file.
Using default.css or inlined styling both doesn't work.
So confusing about this situation.

  • view (resources/views/mail/stat.blade.php)
<div class="element">
        <img class="bg-logo" src="" />
        <img class="logo" src="" />

        <div class="text-title">베이직바이블<br />서비스 주간 리포트</div>
        <div class="font-bold-700 text-service_term">2023.12.01 - 2023.12.07</div>

        <div class="whitebox-base OS">
            <img src="" alt="" class="app-icon">
            <div class="font-bold-700 text-app_name">베이직바이블</div>
            <div class="font-bold-700 div">쇼핑몰 OS정보</div>
            <div class="OS-2">
                <div class="div-2">
                    <img class="img" src="" />
                    <div class="font-bold-700 text-os_ver">6.6 버전</div>
                </div>
                <div class="div-2">
                    <img class="img" src="" />
                    <div class="font-bold-700 text-os_ver">5.0 버전</div>
                </div>
            </div>
            <div class="IOS">
                <div class="font-bold-700 text-wrapper-3">IOS 개발자계정</div>
                <div class="date">
                    <div class="font-bold-700 text-wrapper-4">365일 남음</div>
                    <div class="text-wrapper-5">만료 2024.12.20</div>
                </div>
            </div>
        </div>
        <div class="whitebox-base box-base-1 box-1">
            <div class="font-bold-700 title">APP</div>
            <div class="text-remain_days">
                <div class="font-heavy-400 normal">203</div>
                <div class="font-bold-700 font-24">일</div>
            </div>
        </div>

    </div>
  • route for preview (web.php)
Route::get('mailable', function() {
    // return view('mail.weeklystat');
    $data = App\Models\AppsData::findOrFail(3698);
   
    return new App\Mail\WeeklyStatMail($data);
});
  • for send mail (app/Mail/StatMail.php)
<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

use App\Models\AppsData;

class WeeklyStatMail extends Mailable
{
    use Queueable, SerializesModels;

    public $appsData;    
   
public function __construct(AppsData $appsData)
{
        $this->appsData = $appsData;
}

public function build()
    {
        return $this
            ->subject($this->appsData->app_name." 통계")
            ->markdown('mail.stat');
   }
}

** tried this part like this, but didn't work.**

public function build()
    {
        return $this
            ->subject($this->appsData->app_name." 통계")
            ->view('mail.stat');
   }
}

  • css (resources/views/mail/html/themes/default.css)
html,
body {
    margin: 0px;
    height: 100%;
}

/* a blue color as a generic focus style */
button:focus-visible {
    outline: 2px solid #4a90e2 !important;
    outline: -webkit-focus-ring-color auto 5px !important;
}

a {
    text-decoration: none;
}

@font-face {
    font-family: "SUIT-Bold";
    src: url('/assets/css/fonts/SUIT/SUIT-Bold.ttf') format("truetype");
}

@font-face {
    font-family: "SUIT-Medium";
    src: url('/assets/css/fonts/SUIT/SUIT-Medium.ttf') format("truetype");
}

@font-face {
    font-family: "SUIT-Heavy";
    src: url('/assets/css/fonts/SUIT/SUIT-Heavy.ttf') format("truetype");
}

@font-face {
    font-family: "SUIT-ExtraBold";
    src: url('/assets/css/fonts/SUIT/SUIT-ExtraBold.ttf') format("truetype");
}

.rectangle {
    position: relative;
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.bg-color-red {
    background-color: #f56650;
}

.bg-color-yellow {
    background-color: #ffa812;
}

.bg-color-green {
    background-color: #00a65a;
}

.bg-color-green-2 {
    background-color: #34a853;
}

.bg-color-black {
    background-color: #000;
}


.font-black {
    color: #000;
}

.font-green {
    color: #00a65a;
}

.font-red {
    color: #f56650;
}

.font-white {
    color: #fff;
}

.font-666 {
    color: #666;
}

.font-bold-700 {
    font-family: "SUIT-Bold", Helvetica;
    font-weight: 700;
    letter-spacing: 0;
    line-height: normal;
}

.font-heavy-400 {
    font-family: "SUIT-Heavy", Helvetica;
    font-weight: 400;
    letter-spacing: 0;
    line-height: normal;
}

.whitebox-base {
    position: absolute;
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
}

.title {
    position: relative;
    align-self: stretch;
    margin-top: -1px;
    font-size: 15px;
    color: #666;
}


.yellow_circle {
    display: flex;
    flex-direction: column;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    position: absolute;
    top: 0;
    left: 147px;
    background-color: #ffba00;
    border-radius: 20px;
}

.title_number {
    position: relative;
    width: fit-content;
    margin-top: -6.5px;
    margin-bottom: -4.5px;
    font-family: "SUIT-Heavy", Helvetica;
    font-weight: 400;
    color: #fff;
    letter-spacing: 0;
    line-height: normal;
    font-size: 20px;
}

.text-title {
    position: absolute;
    top: 42px;
    left: 0;
    font-family: "SUIT-ExtraBold", Helvetica;
    font-weight: 800;
    color: #151515;
    font-size: 36px;
    text-align: center;
    letter-spacing: 0;
    line-height: normal;
}

.text-subtitle {
    position: absolute;
    top: 87px;
    left: 22px;
    font-family: "SUIT-Regular", Helvetica;
    font-weight: 400;
    color: #999;
    font-size: 18px;
    text-align: center;
    letter-spacing: 0;
    line-height: normal;
}

.text-unit {
    position: relative;
    width: fit-content;
    color: #151515;
    font-size: 24px;
    text-align: right;
}


.img {
    position: relative;
    width: 16px;
    height: 16px;
}

.num-up {
    color: #e74646;
    font-size: 16px;
    position: relative;
    width: fit-content;
    margin-top: -1px;
    font-family: "SUIT-Bold", Helvetica;
    font-weight: 700;
    text-align: right;
    letter-spacing: 0;
    line-height: normal;
}

.num-down {
    color: #4673e7;
    font-size: 16px;
    position: relative;
    width: fit-content;
    margin-top: -1px;
    font-family: "SUIT-Bold", Helvetica;
    font-weight: 700;
    text-align: right;
    letter-spacing: 0;
    line-height: normal;
}

.data-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    align-self: stretch;
    position: relative;
    gap: 8px;
    width: 100%;
    flex: 0 0 auto;
}









.element {
    position: relative;
    width: 895px;
    height: 605px;
    background-color: #e8ebed;
}

.element .bg-logo {
    position: absolute;
    width: 473px;
    height: 135px;
    top: 0;
    left: 422px;
}

.element .logo {
    position: absolute;
    width: 58px;
    height: 66px;
    top: 48px;
    left: 58px;
}

.element .text-title {
    position: absolute;
    top: 122px;
    left: 58px;
    color: #151515;
    font-size: 48px;
    font-family: "SUIT-ExtraBold", Helvetica;
    font-weight: 800;
    letter-spacing: 0;
    line-height: normal;
}

.element .text-service_term {
    position: absolute;
    top: 244px;
    left: 58px;
    color: #7a7a7a;
    font-size: 20px;
}

.element .OS {
    width: 225px;
    height: 260px;
    top: 305px;
    left: 40px;
}

.element .app-icon {
    position: absolute;
    width: 72px;
    height: 72px;
    top: 47px;
    left: 77px;
    border-radius: 20px;
    border: 1px solid;
    border-color: #0000000d;
    /* background-image: url(https://c.animaapp.com/XyeV1pwN/img/app-icon@2x.png);
    background-size: cover;
    background-position: 50% 50%; */
}

.element .text-app_name {
    position: absolute;
    top: 126px;
    left: 60px;
    font-size: 20px;
    color: #151515;
}

.element .div {
    position: absolute;
    top: 15px;
    left: 16px;
    font-size: 15px;
    color: #666666;
}

.element .OS-2 {
    display: flex;
    width: 193px;
    align-items: flex-start;
    gap: 8px;
    position: absolute;
    top: 159px;
    left: 16px;
}

.element .div-2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 8px;
    position: relative;
    flex: 1;
    flex-grow: 1;
    background-color: #999999;
    border-radius: 8px;
}

.element .img {
    position: relative;
    width: 16px;
    height: 16px;
}

.element .text-os_ver {
    position: relative;
    width: fit-content;
    margin-top: -0.5px;
    color: #ffffff;
    font-size: 12px;
}

.element .IOS {
    display: flex;
    width: 193px;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    position: absolute;
    top: 195px;
    left: 16px;
    background-color: #f1f1f1;
    border-radius: 8px;
    overflow: hidden;
}

.element .text-wrapper-3 {
    position: relative;
    width: fit-content;
    color: #666666;
    font-size: 12px;
}

.element .date {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    flex: 0 0 auto;
}

.element .text-wrapper-4 {
    position: relative;
    width: fit-content;
    margin-top: -1px;
    color: #151515;
    font-size: 14px;
    text-align: right;
}

.element .text-wrapper-5 {
    position: relative;
    width: fit-content;
    color: #999999;
    font-size: 10px;
    text-align: right;
    font-family: "SUIT-Medium", Helvetica;
    font-weight: 500;
    letter-spacing: 0;
    line-height: normal;
    white-space: nowrap;
}

.element .box-base-1 {
    display: flex;
    flex-direction: column;
    width: 181px;
    height: 122px;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px;
}

.element .box-1 {
    top: 305px;
    left: 281px;
}

.element .box-2 {
    top: 305px;
    left: 478px;
}

.element .box-3 {
    top: 305px;
    left: 675px;
}

.element .box-4 {
    top: 443px;
    left: 281px;
}

.element .box-5 {
    width: 181px;
    height: 122px;
    top: 443px;
    left: 478px;
}

.element .box-6 {
    width: 181px;
    height: 122px;
    top: 443px;
    left: 675px;
}

.element .text-remain_days {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    align-self: stretch;
    width: 100%;
    position: relative;
    flex: 0 0 auto;
}

.element .normal {
    color: #151515;
    position: relative;
    width: fit-content;
    margin-top: -1px;
    font-size: 40px;
    text-align: right;
}

.element .not {
    color: #e74646;
}

.element .font-24 {
    font-size: 24px;
}

.element .text-lock {
    position: absolute;
    top: 15px;
    left: 16px;
    color: #666;
    font-size: 15px;
}

.element .locked {
    display: flex;
    width: 66px;
    height: 66px;
    top: 40px;
    left: 57px;
    align-items: center;
    justify-content: center;
    gap: 2px;
    position: relative;
    border-radius: 33px;
    background-color: #ffe39b;
    overflow: hidden;
}

.element .lock {
    position: relative;
    width: 32px;
    height: 33.36px;
}

.element .box-6 .text-not_using {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 24px;
    position: absolute;
    top: 53px;
    left: 45px;
    background-color: #e8ebed;
    border-radius: 28px;
}

.element .not_using {
    position: relative;
    flex: 0 0 auto;
    color: #999;
}

I even tried to copy and paste the default.css to resources/views/vendor/mail/html/themes/default.css, but it doesn't work either.

Also tried to change the css styles to inline styles in stat.blade.php, then it works but not actually worked as the original style.

How can I make it work for this mail styling with css? Would it only worked with table tags?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/Bl68hvU
via IFTTT

samedi 13 janvier 2024

Laravel livewire How to show data in table according to date

hello im new for laravel livewire im trying to foreach data to table by date wise.

EXAMPLE I taken attendance on 1/1/24 table header show DATE-1/1/24 AND ROW Show that date record if we not taken attendance on 2/1/24 than table Hader show DATE-2/1/24 AND ROW Show - means attendance not taken

example

   |  name    |    STD_ID   |    DATE-1/1/24   |   DATE-2/1/24 |  DATE-3/1/24 | DATE-4/1/24 |
   |  john    |    STD_01   |         P        |       -       |       P      |      A      |
   |  sean    |    STD_02   |         P        |       -       |       P      |      P      |

enter image description here

**CONTROLLER**
``
  $this->Data= Attendance::get();
  //This Code Use For Multiple Coleman Marg In single row by student_id 
 $grouped =  $this->Data->groupBy('student_id');
 $this->Attendance_Data = $grouped->all();
``

**BLADE VIEW**

`<table>
   <thead> 
       <tr> 
         <th>NAME</th>
         <th>STD_ID</th>
         <th>DATE-1/1/24</th>
         <th>DATE-2/1/24</th>
         <th>DATE-3/1/24</th>
         <th>DATE-......</th>
         <th>DATE-31/1/24</th>
  </thead>
<tbody>
  @foreach ($this->Attendance_Data as $key=>$Attendance_Datas)                                          
<tr> 
   <td></td>
   <td></td>
 @foreach ($Attendance_Datas as $key=>$Attendance)
   <td> </td>
 @endforeach  
</tr>
   @endforeach
   @endif 
    </tbody> 
</table> `

DATABASCE

id  |     name      |student_id   |  date_of_attendance |   attendance |
1   |    john       |    STD_01   |     2024-01-01      |       P      |
2   |    john       |    STD_01   |     2024-01-03      |       P      |
2   |    john       |    STD_01   |     2024-01-04      |       A      |
3   |    sean       |    STD_02   |     2024-01-01      |       P      |
4   |    sean       |    STD_02   |     2024-01-03      |       P      |
2   |    sean       |    STD_02   |     2024-01-04      |       P      |

i tryid in if and else but not get proper result



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3bCGodR
via IFTTT

lundi 8 janvier 2024

Laravel 5.3, empty() is treating a zero value as empty in a query

In my Laravel project (version 5.3), I'm sending a param in a URL:

&container=0

But by the time it gets into the PHP function that creates an SQL query, it treats the zero as empty and satisfies the empty string portion of this line:

$containerCL = empty($container) ? '' : "AND SHPTABLE.CNT IN (".implode(',',$container).")";

I do want to send an empty string into the query if no option is chosen for this, but in this case, I need to send the zero value as we have some records identified by that being the actual value. How can I let this catch empty parameters but still use zero as an actual value for the query?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/ChndkjZ
via IFTTT

lundi 18 décembre 2023

Retrieve Comments parent on polymorph relationship with only specific columns

Based on Laravel example Comment has polymorph relationship with Post and Video Model.

I can retrieve Comment with Post and Video using $comment->commentable, but it return all columns of Post or Video. Post has id, name, other columns... Video has id, title, other columns...

How to limit certain columns ? I want for Post only id and name columns and for Video only id and title columns

->with(['commentable' => function ($query) {
          $query->select('id', 'name');
      }])

This code will error since Video doesnt have name columns.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/x5pyUn2
via IFTTT

mercredi 6 décembre 2023

FatalErrorException in Handler.php line 26

While migrating to Laravel 5.0 from 4.2 I am getting this error

FatalErrorException in Handler.php line 26: Uncaught TypeError: Argument 1 passed to App\Exceptions\Handler::report() must be an instance of Exception, instance of Error given, called in \vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php on line 74 and defined in C:\app\Exceptions\Handler.php:26 Stack trace: #0 \vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(74): App\Exceptions\Handler->report(Object(Error)) #1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Error)) #2 {main} thrown

I have migrated one application from laravel 4.2 to laravel 5.0, placed all the code according to requirement and done composer update command but white executing this I am getting this error.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/PA0ENzr
via IFTTT