Think you forgot the error and code?
Not able to upload image using livewire in server "The permises_image failed to upload. "
I am not able to upload images to server but my code working fine in the local system (The permises_image failed to upload.) this is the validation error
@Sinnbeck "The permises_image failed to upload. " this is error and I don't know how to upload code here
@Jagdeesh You "upload code here" by putting your code within 3 backticks (`)
@Jagdeesh https://help.github.com/articles/creating-and-highlighting-code-blocks/
And it sounds like you might have some permissions issues on the server.
@Laralex '''
Add Office Inventory
Unit Name @error('p_name') {{$message}} @enderror Building Name @error('b_name') {{$message}} @enderror Select Category Office Space Retail Space @error('category_id') {{ $message }} @enderror Select Property Status Active InActive @error('category_id') {{ $message }} @enderror Property Price @error('p_price') {{$message}} @enderror Property Address @error('p_address') {{$message}} @enderror Location @error('p_location') {{$message}} @enderror About Property @error('about_p') {{$message}} @enderror Total Super Area @error('total_area') {{$message}} @enderror Developer Name @error('d_name') {{$message}} @enderror Floor Area @error('f_area') {{$message}} @enderror Property Possession Status Ready To Move Under Construction Possession Soon @error('category_id') {{ $message }} @enderror Certificate Yes No N/A @error('category_id') {{ $message }} @enderror Number Of Floor @error('n_floor') {{$message}} @enderror Completion Year @error('c_year') {{$message}} @enderror Fire NOC Yes No N/A @error('f_noc') {{ $message }} @enderror Car Parking @error('car_parking') {{$message}} @enderror CAM Charges @error('cam_charges') {{$message}} @enderror Available Area @error('available_area') {{$message}} @enderror Unit Rate @error('unit_rate') {{$message}} @enderror Select Zone IT ITS Industrial Commercial Mix Land Insititutional @error('zone') {{ $message }} @enderror Floor On Offer Basement Ground 1st Floor 2nd Floor 3rd Floor 4th Floor 5th Floor 6th Floor 7th Floor 8th Floor 9th Floor 10th Floor 11th Floor 12th Floor 13th Floor 14th Floor 15th Floor 16th Floor 17th Floor 18th Floor 19th Floor 20th Floor @error('floor_on_offer') {{ $message }} @enderror Type of Premises BareShell warmshell Semi Furnished Furnished @error('type_permises') {{ $message }} @enderror LockIn Period 0 Years 3 Years 5 Years 9 Years @error('lockin_period') {{ $message }} @enderror <div class="form-floating mb-3 mt-1">
<input type="email" wire:model.lazy="comments" class="form-control" id="floatingInput" placeholder="Comments">
<label for="floatingInput">Comments</label>
@error('comments') <span class="text-danger">{{$message}}</span> @enderror
</div>
</div>
<div class="col-lg-6">
<div class="form-floating mb-3 mt-1">
<input type="text" wire:model.lazy="date_a" class="form-control" id="floatingInput" placeholder="Date Of Availability">
<label for="floatingInput">Date Of Availability</label>
@error('date_a') <span class="text-danger">{{$message}}</span> @enderror
</div>
<div class="form-floating mb-3 mt-1">
<input type="text" wire:model.lazy="rent_furnished" class="form-control" id="floatingInput" placeholder="Furnished Rent">
<label for="floatingInput">Furnished Rent</label>
@error('rent_furnished') <span class="text-danger">{{$message}}</span> @enderror
</div>
<div class="form-floating mb-3 mt-1">
<select class="form-select form-control-label mt-4" wire:model.lazy="r_s_deposit" aria-label="Default select example">
<option selected>Security Deposit</option>
<option value="1 Month">1 Month</option>
<option value="2 Months">2 Months</option>
<option value="3 Months">3 Months</option>
<option value="4 Months">4 Months</option>
<option value="5 Months">5 Months</option>
<option value="6 Months">6 Months</option>
</select>
@error('r_s_deposit') <span class="text-danger">{{ $message }}</span> @enderror
</div>
<div class="form-floating mb-3 mt-1">
<select class="form-select form-control-label mt-4" wire:model.lazy="rent_e" aria-label="Default select example">
<option selected>Rent Escalation</option>
<option value="5% Every Year">5% Every Year </option>
<option value="15% Every Three Year">15% Every Three Year</option>
</select>
@error('rent_e') <span class="text-danger">{{ $message }}</span> @enderror
</div>
<div class="form-floating mb-3 mt-1">
<select class="form-select form-control-label mt-4" wire:model.lazy="lease_term" aria-label="Default select example">
<option selected>Lease Term</option>
<option value="3 Years">3 Years </option>
<option value="3+3+3 Years">3+3+3 Years</option>
<option value="15 Years">15 Years</option>
</select>
@error('lease_term') <span class="text-danger">{{ $message }}</span> @enderror
</div>
</div>
</div>
</div>
<div class="step step-4">
<div class="row">
<div class="col-lg-6">
<div class="form-floating mb-3 mt-1">
<input type="text" wire:model.lazy="o_name" class="form-control" id="floatingInput" placeholder="Contact Person">
<label for="floatingInput">Contact Person</label>
@error('o_name') <span class="text-danger">{{$message}}</span> @enderror
</div>
<div class="form-floating mb-3 mt-1">
<input type="text" wire:model.lazy="mobile_number" class="form-control" id="floatingInput" placeholder="Mobile NUmber">
<label for="floatingInput">Mobile NUmber</label>
@error('mobile_number') <span class="text-danger">{{$message}}</span> @enderror
</div>
</div>
<div class="col-lg-6">
<div class="form-floating mb-3 mt-1">
<input type="email" wire:model.lazy="email_id" class="form-control" id="floatingInput" placeholder="Email Id ">
<label for="floatingInput">Email Id </label>
@error('email_id') <span class="text-danger">{{$message}}</span> @enderror
</div>
<div class="form-group mb-3 mt-1">
<label for="city" class=" form-control-label">Permises Image</label>
<input type="file" wire:model.lazy="permises_image" id="permises_image" name="permises_image" placeholder="Upload Images" class="form-control" >
<div wire:loading wire:target="permises_image">Uploading...</div>
@error('permises_image') <span class="text-danger">{{ $message }}</span> @enderror
</div>
</div>
</div>
</div>
<div class="step step-4">
<div class="row">
<div class="col-lg-6">
<div class="form-group mb-3 mt-1">
<label for="city" class=" form-control-label">Building Image</label>
<input type="file" wire:model.lazy="building_facade_image" id="building_facade_image" name="building_facade_image" class="form-control" >
<div wire:loading wire:target="building_facade_image">Uploading...</div>
@error('building_facade_image') <span class="text-danger">{{ $message }}</span> @enderror
</div>
<div class="form-group mb-3 mt-1">
<label for="city" class=" form-control-label">Comman Area Image</label>
<input type="file" wire:model.lazy="comman_area_image" id="comman_area_image" name="comman_area_image" class="form-control" >
<div wire:loading wire:target="comman_area_image">Uploading...</div>
@error('comman_area_image') <span class="text-danger">{{ $message }}</span> @enderror
</div>
<div class="form-group mb-3 mt-1">
<label for="city" class=" form-control-label">Building Left Image</label>
<input type="file" wire:model.lazy="b_left_image" id="b_left_image" name="b_left_image" class="form-control" >
<div wire:loading wire:target="b_left_image">Uploading...</div>
@error('b_left_image') <span class="text-danger">{{ $message }}</span> @enderror
</div>
<div class="form-group mb-3 mt-1">
<label for="city" class=" form-control-label">Extra Images</label>
<input type="file" wire:model.lazy="media" id="media" name="media" class="form-control" multiple>
<div wire:loading wire:target="media">Uploading...</div>
@error('media') <span class="text-danger">{{ $message }}</span> @enderror
</div>
</div>
<div class="col-lg-6">
<div class="form-group mb-3 mt-1">
<label for="city" class=" form-control-label">Building Right Image</label>
<input type="file" wire:model.lazy="b_right_image" id="b_right_image" name="b_right_image" class="form-control" >
<div wire:loading wire:target="b_right_image">Uploading...</div>
@error('b_right_image') <span class="text-danger">{{ $message }}</span> @enderror
</div>
<div class="form-group mb-3 mt-1">
<label for="city" class=" form-control-label">Building Opposite Image</label>
<input type="file" wire:model.lazy="b_opposite_image" id="b_opposite_image" name="b_opposite_image" class="form-control" >
<div wire:loading wire:target="b_opposite_image">Uploading...</div>
@error('b_opposite_image') <span class="text-danger">{{ $message }}</span> @enderror
</div>
<div class="form-group mb-3 mt-1">
<label for="city" class=" form-control-label">Building Nearby Image</label>
<input type="file" wire:model.lazy="b_nearby_image" id="b_nearby_image" name="b_nearby_image" class="form-control" >
<div wire:loading wire:target="b_nearby_image">Uploading...</div>
@error('b_nearby_image') <span class="text-danger">{{ $message }}</span> @enderror
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<span x-on:click="on = false">
<button type="button" class="btn btn-primary" wire:click.prevent="OfficeDataSubmit()">Submit Details</button>
</span>
</div>
</div>
<div class="form-group">
<input type="hidden" wire:model.defer="slug" id="slug" name="slug" class="form-control">
@error('slug') <span class="text-danger">{{ $message }}</span> @enderror
</div>
</form>
</div>
</section>
</div>
</div>
''' This Is Blade File '''<?php
namespace App\Http\Livewire\Admin\Inventory\OfficeInventory; use Illuminate\Support\Facades\Storage;
use Livewire\Component; use Livewire\WithFileUploads; use Livewire\WithPagination; use App\Models\Properties; use App\Models\officeImages; use Carbon\Carbon; use Session; use Str; class AllInventoryComponent extends Component { use WithPagination; use WithFileUploads; public $media=[]; public $inventoryImage; public $inventory_id; public $selectedRows=[]; public $selectedPageRows=false; public $countdeactiveInventory; public $deactiveInventory; protected $queryString=['status']; public $ids, $p_name, $category_id, $p_status, $p_price, $p_address, $p_location, $a_checkbox, $about_p, $total_area, $d_name, $f_area, $possession_status, $certificate, $n_floor, $l_map, $c_year, $f_noc, $image, $car_parking, $available_area, $cam_charges, $unit_rate, $tax, $hsn_code, $b_name, $zone, $floor_on_offer, $date_a, $rent_furnished, $rent_e, $r_s_deposit, $lease_term, $lockin_period, $o_name, $mobile_number, $email_id, $comments,$type_permises, $permises_image,$building_facade_image, $comman_area_image, $b_left_image, $b_right_image, $b_opposite_image, $b_nearby_image; public $status=null; public $term; public $slug; protected $paginationTheme = 'bootstrap'; public function paginationView() { return view('vendor.livewire.bootstrap'); } public function filterInventory($status=null){ // $this->resetPage(); $this->status=$status; } // public function generateSlug() // { // $this->slug = SlugService::createSlug(Properties::class, 'slug', $this->p_name); // } public function updatedSelectedPageRows($value){
if($value){
$this->selectedRows=$this->properties->pluck('id')->map(function ($id){
return (string) $id;
});
}
else{
$this->reset(['selectedRows','selectedPageRows']);
}
}
public function getPropertiesProperty(){
return Properties::when($this->status,function($query,$status){
return $query->where('status',$this->status);
})
->paginate(5);
}
public function render()
{
$new_user_id=$this->ids=session('SUPER_USER_ID');
if(session::has('SUPER_ADMIN_LOGIN')){
if(isset($this->term)){
return view('livewire.admin.inventory.office-inventory.all-inventory-component',[
'properties'=>Properties::when($this->term, function($query,$term){
return $query->where('p_name','LIKE',"%$term%")
->orwhere('p_address','like',"%$term%")
->orwhere('p_location','like',"%$term%");
})->paginate(5),
])->layout('livewire.app');
}
else{
$properties=$this->Properties;
$this->countInventory =Properties::count();
$this->countdeactiveInventory =Properties::where('status','Deactive')->count();
$this->pendingInventory =Properties::where('status','Unapproved')->count();
return view('livewire.admin.inventory.office-inventory.all-inventory-component',[
'countInventory'=> $this->countInventory,
'pendingInventory'=>$this->pendingInventory,
'countdeactiveInventory'=>$this->deactiveInventory,
'properties'=>$properties,
])->layout('livewire.app');
}
} else{ // return view('livewire.admin.inventory.office-inventory.all-inventory-component',[ // 'properties'=>Properties::where('u_id',$new_user_id)->paginate(5), // ])->layout('livewire.app'); if(isset($this->term)){ return view('livewire.admin.inventory.office-inventory.all-inventory-component',[
'properties'=>Properties::when($this->term, function($query,$term){
return $query->where('p_name','LIKE',"%$term%")
->orwhere('p_address','like',"%$term%")
->orwhere('p_location','like',"%$term%");
})->paginate(5),
])->layout('livewire.app');
}
else{
$properties= Properties::where('u_id',$new_user_id)->when($this->status,function($query,$status){
return $query->where('status',$this->status);
})
->paginate(5);
$this->countInventory =Properties::where('u_id',$new_user_id)->count();
$this->countdeactiveInventory =Properties::where('u_id',$new_user_id)->
where('status','Deactive')->count();
$this->pendingInventory =Properties::where('u_id',$new_user_id)->
where('status','Unapproved')->count();
return view('livewire.admin.inventory.office-inventory.all-inventory-component',[
'countInventory'=> $this->countInventory,
'pendingInventory'=>$this->pendingInventory,
'countdeactiveInventory'=>$this->deactiveInventory,
'properties'=>$properties,
])->layout('livewire.app');
}
}
} private function resetForm(){ $this->p_name = ''; $this->slug = ''; $this->p_status = ''; $this->p_price = ''; $this->p_address = ''; $this->p_location = ''; $this->about_p = ''; $this->total_area = ''; $this->d_name = ''; $this->f_area = ''; $this->possession_status = ''; $this->certificate = ''; $this->n_floor = ''; $this->l_map = ''; $this->c_year = ''; $this->f_noc = ''; $this->image = ''; $this->car_parking = ''; $this->available_area = ''; $this->cam_charges = ''; $this->status = ''; $this->unit_rate = ''; $this->tax = ''; $this->hsn_code = ''; $this->b_name = ''; $this->zone = ''; $this->floor_on_offer = ''; $this->date_a = ''; $this->rent_furnished = ''; $this->rent_e = ''; $this->r_s_deposit = ''; $this->lease_term = ''; $this->lockin_period = ''; $this->o_name = ''; $this->mobile_number = ''; $this->email_id = ''; $this->comments = ''; $this->media = ''; $this->type_permises = '';$this->permises_image = '';$this->building_facade_image = ''; $this->comman_area_image = '';$this->b_left_image = '';$this->b_right_image = '';$this->b_opposite_image = ''; $this->b_nearby_image = '';
}
public function OfficeDataSubmit(){
$data = $this->Validate([
'p_name' =>'required','p_status' =>'required','p_price' =>'required',
'p_address' =>'required','p_location' =>'required','about_p' =>'required','total_area' =>'required',
'd_name' =>'required','f_area' =>'required','possession_status' =>'required','certificate' =>'required',
'n_floor' =>'required','c_year'=> 'required',
'f_noc'=> 'required','car_parking'=> 'required','available_area'=> 'required',
'cam_charges'=> 'required', 'unit_rate'=> 'required','b_name'=> 'required','zone'=> 'required','floor_on_offer'=> 'required',
'date_a'=> 'required','rent_furnished'=> 'required','rent_e'=> 'required',
'r_s_deposit'=> 'required','lease_term'=> 'required','lockin_period'=> 'required','o_name'=> 'required',
'mobile_number'=> 'required','email_id'=> 'required','comments'=> 'required',
'media.*'=> 'required|image|max:1024','type_permises'=>'required','permises_image'=>'required','building_facade_image'=>'required',
'comman_area_image'=>'required','b_left_image'=>'required','b_right_image'=>'required','b_opposite_image'=>'required',
'b_nearby_image'=>'required',
]);
$new_user_id=$this->ids=session('SUPER_USER_ID');
$uniqueId = Carbon::now()->timestamp.uniqid();
$officeInventory = new Properties();
$officeInventory->permises_image=$this->permises_image->store('office_inventory_images','public');
$officeInventory->building_facade_image=$this->building_facade_image->store('office_inventory_images','public');
$officeInventory->comman_area_image=$this->comman_area_image->store('office_inventory_images','public');
$officeInventory->b_left_image=$this->b_left_image->store('office_inventory_images','public');
$officeInventory->b_right_image=$this->b_right_image->store('office_inventory_images','public');
$officeInventory->b_opposite_image=$this->b_opposite_image->store('office_inventory_images','public');
$officeInventory->b_nearby_image=$this->b_nearby_image->store('office_inventory_images','public');
$officeInventory->p_name=$this->p_name;
$officeInventory->slug=Str::slug($this->p_name);
$officeInventory->p_status=$this->p_status;
$officeInventory->p_price=$this->p_price;
$officeInventory->p_address=$this->p_address;
$officeInventory->p_location=$this->p_location;
$officeInventory->about_p=$this->about_p;
$officeInventory->total_area=$this->total_area;
$officeInventory->d_name=$this->d_name;
$officeInventory->f_area=$this->f_area;
$officeInventory->possession_status=$this->possession_status;
$officeInventory->certificate=$this->certificate;
$officeInventory->n_floor=$this->n_floor;
$officeInventory->c_year=$this->c_year;
$officeInventory->f_noc=$this->f_noc;
$officeInventory->car_parking=$this->car_parking;
$officeInventory->available_area=$this->available_area;
$officeInventory->cam_charges=$this->cam_charges;
$officeInventory->unit_rate=$this->unit_rate;
$officeInventory->tax=$this->tax;
$officeInventory->hsn_code=$this->hsn_code;
$officeInventory->b_name=$this->b_name;
$officeInventory->zone=$this->zone;
$officeInventory->floor_on_offer=$this->floor_on_offer;
$officeInventory->date_a=$this->date_a;
$officeInventory->rent_furnished=$this->rent_furnished;
$officeInventory->rent_e=$this->rent_e;
$officeInventory->r_s_deposit=$this->r_s_deposit;
$officeInventory->lease_term=$this->lease_term;
$officeInventory->lockin_period=$this->lockin_period;
$officeInventory->o_name=$this->o_name;
$officeInventory->mobile_number=$this->mobile_number;
$officeInventory->email_id=$this->email_id;
$officeInventory->comments=$this->comments;
$officeInventory->type_permises=$this->type_permises;
$officeInventory->unique_id= $uniqueId;
if(session('SUPER_USER_LOGIN')){
$officeInventory->status='UnApproved';
}
else{
$officeInventory->status='Active';
}
$officeInventory->u_id= $new_user_id;
foreach ($this->media as $key => $image) {
$new_media= new officeImages();
$new_media->officeinventory_unique_id = $uniqueId ;
$imageName= Carbon::now()->timestamp . $key. '.'.$this->media[$key]->extension();
$this->media[$key]->storeAs('office_inventory_images', $imageName);
$new_media->media= $imageName;
$new_media->save();
}
$officeInventory->save();
session()->flash('message', 'Office Inventory Added Successfully.');
$this->resetForm();
$this->emit('officeInventoryInserted');
$this->emit('alertRemove');
}
public function edit($id){
$officeInventory = Properties::where('id', $id)->first();
$this->inventory_id =$officeInventory->id;
$this->inventoryImage=officeImages::where('officeinventory_unique_id',$officeInventory->unique_id)->get();
$this->p_name =$officeInventory->p_name;
$this->slug =$officeInventory->slug;
$this->p_status =$officeInventory->p_status;
$this->p_price =$officeInventory->p_price;
$this->p_address =$officeInventory->p_address;
$this->p_location =$officeInventory->p_location;
$this->about_p =$officeInventory->about_p;
$this->total_area =$officeInventory->total_area;
$this->d_name =$officeInventory->d_name;
$this->f_area =$officeInventory->f_area;
$this->possession_status =$officeInventory->possession_status;
$this->certificate =$officeInventory->certificate;
$this->n_floor =$officeInventory->n_floor;
$this->c_year =$officeInventory->c_year;
$this->f_noc =$officeInventory->f_noc;
$this->car_parking =$officeInventory->car_parking;
$this->available_area =$officeInventory->available_area;
$this->cam_charges =$officeInventory->cam_charges;
$this->unit_rate =$officeInventory->unit_rate;
$this->tax =$officeInventory->tax;
$this->hsn_code =$officeInventory->hsn_code;
$this->b_name =$officeInventory->b_name;
$this->zone =$officeInventory->zone;
$this->floor_on_offer =$officeInventory->floor_on_offer;
$this->date_a =$officeInventory->date_a;
$this->rent_furnished =$officeInventory->rent_furnished;
$this->rent_e =$officeInventory->rent_e;
$this->r_s_deposit =$officeInventory->r_s_deposit;
$this->lease_term =$officeInventory->lease_term;
$this->lockin_period =$officeInventory->lockin_period;
$this->o_name =$officeInventory->o_name;
$this->mobile_number =$officeInventory->mobile_number;
$this->email_id =$officeInventory->email_id;
$this->comments =$officeInventory->comments;
$this->type_permises =$officeInventory->type_permises;
}
public function officeinventoryUpdate(){
$data = $this->Validate([
'p_name' =>'required',
'slug' =>'required',
'p_status' =>'required',
'p_price' =>'required',
'p_address' =>'required',
'p_location' =>'required',
'about_p' =>'required',
'total_area' =>'required',
'd_name' =>'required',
'f_area' =>'required',
'possession_status' =>'required',
'certificate' =>'required',
'n_floor' =>'required',
'c_year' =>'required',
'f_noc' =>'required',
'car_parking' =>'required',
'available_area' =>'required',
'cam_charges' =>'required',
'unit_rate' =>'required',
// 'tax' =>'required',
// 'hsn_code' =>'required',
'b_name' =>'required',
'zone' =>'required',
'floor_on_offer' =>'required',
'date_a' =>'required',
'rent_furnished' =>'required',
'rent_e' =>'required',
'r_s_deposit' =>'required',
'lease_term' =>'required',
'lockin_period' =>'required',
'o_name' =>'required',
'mobile_number' =>'required',
'email_id' =>'required',
'comments' =>'required',
'type_permises' =>'required',
// 'media.*'=> 'required|image|max:1024',
]);
$officeinventory = Properties::where('id',$this->inventory_id)->first();
if($this->permises_image){
$officeinventory->permises_image = $this->permises_image->store('office_inventory_images','public');
}
if($this->building_facade_image){
$officeinventory->building_facade_image=$this->building_facade_image->store('office_inventory_images','public');
}
if($this->comman_area_image){
$officeinventory->comman_area_image=$this->comman_area_image->store('office_inventory_images','public');
}
if($this->b_left_image){
$officeinventory->b_left_image=$this->b_left_image->store('office_inventory_images','public');
}
if($this->b_right_image){
$officeinventory->b_right_image=$this->b_right_image->store('office_inventory_images','public');
}
if($this->b_opposite_image){
$officeinventory->b_opposite_image=$this->b_opposite_image->store('office_inventory_images','public');
}
if($this->b_nearby_image){
$officeinventory->b_nearby_image=$this->b_nearby_image->store('office_inventory_images','public');
}
$officeinventory->p_name= $this->p_name;
$officeinventory->slug= $this->slug;
$officeinventory->p_status=$this->p_status;
$officeinventory->p_price=$this->p_price;
$officeinventory->p_address= $this->p_address;
$officeinventory->p_location=$this->p_location;
$officeinventory->about_p=$this->about_p;
$officeinventory->total_area= $this->total_area;
$officeinventory->d_name=$this->d_name;
$officeinventory->f_area=$this->f_area;
$officeinventory->possession_status=$this->possession_status;
$officeinventory->certificate=$this->certificate;
$officeinventory->n_floor=$this->n_floor;
$officeinventory->c_year= $this->c_year;
$officeinventory->f_noc=$this->f_noc;
$officeinventory->car_parking=$this->car_parking;
$officeinventory->available_area=$this->available_area;
$officeinventory->cam_charges=$this->cam_charges;
$officeinventory->unit_rate=$this->unit_rate;
$officeinventory->tax=$this->tax;
$officeinventory->hsn_code=$this->hsn_code;
$officeinventory->b_name=$this->b_name;
$officeinventory->zone=$this->zone;
$officeinventory->floor_on_offer=$this->floor_on_offer;
$officeinventory->date_a=$this->date_a;
$officeinventory->rent_furnished=$this->rent_furnished;
$officeinventory->rent_e=$this->rent_e;
$officeinventory->r_s_deposit=$this->r_s_deposit;
$officeinventory->lease_term=$this->lease_term;
$officeinventory->lockin_period=$this->lockin_period;
$officeinventory->o_name=$this->o_name;
$officeinventory->mobile_number=$this->mobile_number;
$officeinventory->email_id=$this->email_id;
$officeinventory->comments=$this->comments;
$officeinventory->type_permises=$this->type_permises;
$officeinventory->save();
if($this->media != ''){
foreach ($this->media as $key => $image) {
$new_media= new officeImages();
$new_media->officeinventory_unique_id = $officeinventory->unique_id ;
$imageName= Carbon::now()->timestamp . $key. '.'.$this->media[$key]->extension();
$this->media[$key]->storeAs('office_inventory_images', $imageName);
$new_media->media= $imageName;
$new_media->save();
}
}
$this->media='';
session()->flash('message','Office Inventory Updated Successfully');
$this->resetForm();
$this->emit('edit-office-inventory-Updated');
$this->emit('alertRemove');
}
public function delete($id)
{
if($id){
Properties::where('id',$id)->delete();
session()->flash('message', 'Office Inventory Deleted Successfully.');
$this->emit('alertRemove');
}
}
public function deleteImage($id){
if($id){
officeImages::where('id',$id)->delete();
session()->flash('message', 'Image Deleted Successfully.');
}
}
public function deleteSelectedRows(){
Properties::whereIn('id', $this->selectedRows)->delete();
$this->reset(['selectedRows','selectedPageRows']);
session()->flash('message', 'Selected Inventory Deleted Successfully.');
}
public function approvedSelected(){
Properties::whereIn('id',$this->selectedRows)->Update(['status'=>'Active']);
$this->reset(['selectedRows','selectedPageRows']);
session()->flash('message', 'Selected Inventory Approved Successfully.');
}
public function deactivateSelected(){
Properties::whereIn('id',$this->selectedRows)->Update(['status'=>'Deactive']);
$this->reset(['selectedRows','selectedPageRows']);
session()->flash('message', 'Selected Inventory Deactivated Successfully.');
}
} ''' This is component
Please or to participate in this conversation.