When i try to upload a csvfile its MIME type changes to application/octet-stream. Although i specified enctype="multipart/form-data" in the form, how can i fix that? <div class=”container mt-5″> <form action=”{{route(‘fileUpload’)}}” method=”POST” enctype=”multipart/form-data”> <h3 class=”text-center mb-5″>Download file</h3> @csrf @if ($message = Session::get(‘success’)) <div class=”alert alert-success”> <strong>{{ $message }}</strong> </div> @endif @if (count($errors) > 0) <div class=”alert ..

Read more

I am using Laravel 8 and the User model has relation with model UserProfile as following class User extends Authenticatable { use LaratrustUserTrait; use HasApiTokens; use HasFactory; use HasProfilePhoto; use Notifiable; use TwoFactorAuthenticatable; . . . public function profile(){ return $this->hasOne(UserProfile::class,’user_id’); } } when i create a new user i directly do login for him ..

Read more

I want to display my form like it is shown the below image- form-input image I have form input like this- <?= form_input([‘name’ => ’email_for_confirmation’, ‘id’ => ’email_for_confirmation’, ‘value’ => ”, ‘class’ => ‘form-control’, ‘placeholder’ => ‘Email’,’content’ =>”]) ?> <i class="form-icon fa fa-envelope-o"></i> I have tried content but it doesn’t work. Help would be appreciated. ..

Read more

I’m getting an error stream_copy_to_stream(): read of 8192 bytes failed with errno=21 Is a directory when i upload a csv file. I changed in the configuration of php.ini and i increased the values of upload_max_filesize, post_max_size and memory_limit but i still get the error. My code is : public function parseImport(Request $req) { if ($req->file()) ..

Read more

I have a problem with vue-draggable with elements not going to their precise end element, Here’s a video to demonstrate the problem: https://imgur.com/a/gsv5rDw As u can see, Sometimes it works; othertimes, it does not. Cardlist.vue <template> <div class="p-3 w-80 flex-shrink-0 bg-gray-100 rounded"> <div class="flex justify-between" v-if="editingCardlist === false"> <div class="text-gray-700 font-semibold font-sans tracking-wide text-sm" @click="startListEditing">{{ ..

Read more

I have a column start_time of type date and a column duration_temp of type Integer and I made a new column duration of type timestamp I want to fill duration column with those values: only the date without hours, minutes and seconds from start_time and add the value of "duration_temp" as minutes to this date. ..

Read more

I am trying to authenticate api calls in my laravel application. I have installed Passport following the documentation and I think I have not missed anything. but API call returns a 401 Unauthenticated. Auth.php ‘guards’ => [ ‘web’ => [ ‘driver’ => ‘session’, ‘provider’ => ‘users’, ], ‘api’ => [ ‘driver’ => ‘passport’, ‘provider’ => ..

Read more

USER MODEL public function roles() { return $this->belongsTo(User::class, ‘roles’); } ROLE MODEL public function users() { return $this->hasMany(Role::class, ‘role_id’); } BLADE FILE <tbody> @foreach($users as $user) <tr> <td>{{$user->name}}</td> <td>{{$user->email}}</td> <td>{{$user->country}}</td> <td>{{$user->state}}</td> <td>{{$user->city}}</td> <td>{{$user->role_id}}</td> <td> <button><a href="{{route(‘edituser’, $user->id)}}">EDIT</a></button> </td> <td> <button class="deleteuser" data-id="{{ $user->id }}" data-token="{{ csrf_token() }}">DELETE</button> </td> </tr> @endforeach </tbody> role_id is foreign key ..

Read more

i installed composer and have php 8 but after creating first laravel project, am facing this error. Where ever i make project, i face this same error PHP Warning: require(C:Program Filesxampphtdocslaravelmyappp/vendor/autoload.php): Failed to open stream: No such file or directory in C:Program Filesxampphtdocslaravelmyapppartisan on line 18 PHP Fatal error: Uncaught Error: Failed opening required ‘C:Program ..

Read more

I’m trying to send mail using mail() function in Laravel. here is my code. $to = "[email protected]"; $subject = "subject"; $txt = "Some text"; $header = "From: [email protected] rn"; $header.= "MIME-Version: 1.0rn"; $header.= "Content-Type: text/html; charset=ISO-8859-1rn"; $header.= "X-Priority: 1rn"; $succ = mail($to,$subject,$txt,$header); if($succ){ echo "Mail Sent"; } else{ print_r(error_get_last()[‘message’]); } This code shows blank page ..

Read more

I am doing email verification while user registration in laravel-8. i have set below codes in routes as per docs https://laravel.com/docs/8.x/verification#the-email-verification-handler sending verification email working fine but when click on verification link that it give me an error that EmailVerificationRequest class does not exist. use IlluminateHttpRequest; use IlluminateFoundationAuthEmailVerificationRequest; Route::get(‘/email/verify/{id}/{hash}’, function (EmailVerificationRequest $request) { $request->fulfill(); return ..

Read more

I’m working with Laravel 5.8 and in this project, I want to insert a session value into the DB: if(session(‘video-products’)){ UserVideo::create([ ‘user_id’ => auth()->user()->usr_id, ‘product_id’ => session(‘video-products’), ‘order_id’ => $orderId, ]); } But it does not work out and inserts nothing. And when I dd(session(‘video-products’)), I get this: array:1 [▼ 0 => 33 ] And ..

Read more

i have to retry data from this app, OnWebChange.it asks me the callback url. HTTP POST Callback URL http://127.0.0.1:8000/my/page The following table details the additional parameters that OnWebChange will append to the callback URL: Parameter name Description femtoo_callback_url The URL being tracked femtoo_callback_data The new tracker content concatenated to the first 2500 characters femtoo_callback_label The ..

Read more

i’m having a Clinic(id,name,&services from service class on it ) and when i need to store my services on database it saved normally but with an empty array without my services data here is my view <form class="form-horizontal" wire:submit.prevent="storeClinic"> <div class="form-group"> <label class="col-md-4 control-label">اسم العيادة</label> <div class="col-md-4"> <input type="text" placeholder="اسم العيادة" id="name" name="name" class="form-control input-md" ..

Read more

So this query works beautifully: Post::where(‘id’, $id) ->with([ ‘comments’ => function($query) { $query->where(‘marked_as’, ‘active’); }, ]) ->withCount([ ‘comments as comments_active_count’ => function ($q) { $q->where(‘comments.marked_as’, ‘active’); }, ‘comments as comments_not_active_count’ => function ($q) { $q->where(‘comments.marked_as’, ‘not_active’); }, ]) ->firstOrFail(); But next to getting the count separately, I also like to get the comments collection separately ..

Read more