Category : controller

I am trying to execute the following code, the error applies to the $waitingToBeShipped… section of the code. As you can see I am using an innerJoin. I want to retrieve all of the rows that have orders containing products that are still waiting to be shipped. public function destroyMany($ids) { $status = false; $ids ..

Read more

Demonstration on how my catagory_id is being read (console.log each time I press the edit button) $(document).on(‘click’,’.edit_category’,function (e) { e.preventDefault(); var cat_id = $(this).val(); console.log(cat_id); }); My problem is when I try to output the an array shown at the consoles by clicking the edit button (testing purposes) Not sure how I still get the ..

Read more

I am trying to call my table contents using ajax append from a laravel controller function. I am getting this error though Ajax: function fetchcategory() { $.ajax({ type: "GET", url: "/clinical/bbr-category-configuration-data", dataType: "json", success: function (response){ // console.log(response.all_categories); $.each(response.all_categories, function (key, item) { $(‘tbody’).append(‘<tr> <td>’+item.category_name+'</td> <td>’+item.category_name+'</td> <td>’+item.category_name+'</td> <td>’+item.category_name+'</td> </tr>’); }); } }); } Controller: (tabled ..

Read more

I’m trying to set up a small Laravel application , where I’ve blog posts and when I click on show more, I’ll display the blog from it’s specific ID. I’ve my blog routes installed : Route::get(‘blog’,[BlogController::class,’show’]); Route::get(‘blog-single/{blog}’,[BlogController::class,’showMore’]); The {blog} wildcard in the blog-single route should take an id as parameter in showMore function and find ..

Read more

$category = new HmsBbrCategory; $category->category_name = $request->input(‘category_name’); $category->category_description = $request->input(‘category_description’); $category->save(); $category->category_id = $category->id; $category->save(); I have this table, only the id is set to not null. I need to insert the column WITHOUT using auto increment, what do I add to my function? I was thinking to count the id and just to add ..

Read more

I am trying to add two columns: id and category_id and I need both to be the same value $category = new HmsBbrCategory; $category->id = increments(); $category->category_id = id+1; $category->category_name = $request->input(‘category_name’); $category->category_description = $request->input(‘category_description’); $category->save(); return response()->json([ ‘status’=>200, ‘message’=>’Category Added!’, ]); as you can see, both columns return null, tried adding two lines but ..

Read more

It seems like my save(); in my categories does not function as intended below. I will show the necessary codes first: my table name is hms_bbr_category which is also connectec to my .env locally: DB_CONNECTION=pgsql DB_HOST=localhost DB_PORT=5432 DB_DATABASE=jhs DB_USERNAME=postgres DB_PASSWORD=pa55wor0 my model: HmsBbrCategory class HmsBbrCategory extends Model { protected $table = ‘hms_bbr_category’; protected $fillable = ..

Read more

I setup the url by JavaScript to call a function in controller with only one parameter($RoleID) like this $(document).on(‘change’,’#role’,function(){ $RoleID = $(this).val(); let $url = ‘{{route("Admin.role.permission.LoadMember",’:id’)}}’ $url = $url.replace(‘:id’, $RoleID); $.ajax({ url:$url, success:function(data) { $(‘#member’).append(data); }// end fucntion success }); }); It works ok, Now I would like to do the same with more than ..

Read more

Still new to laravel, learning how the $request interacts with create. here is my form for two of my variables for context: <form method="POST" id="postForm"> {{– @csrf –}} <input type="hidden" id="id_hidden" name="id" /> <div class="form-group"> <label for="title"> Title <span class="text-danger">*</span></label> <input type="text" name="title" id="title" class="form-control"> </div> <div class="form-group"> <label for="category_description"> Description <span class="text-danger">*</span></label> <textarea name="category_description" ..

Read more

Please help me. I have these 3 tables, and I have problems on how to call the category name based on the restaurant id from Controller to view. Thank you in advance. Table items Table categories Table restorant This is my Controller public function index() { if (auth()->user()->hasRole(‘owner’)) { $items = Items::with(‘category’)->get(); $restorant_id = auth()->user()->restorant->id; ..

Read more

I created folder in Controller. But Laravel is giving Target class [AppHttpControllersSAIDESaideMerchantController] does not exist. error –>Controller <?php namespace AppHttpControllersSAIDE; use IlluminateHttpRequest; use IlluminateSupportFacadesSchema; class SaideMerchantController extends Controller { public function home() { return view(‘backoffice.saide.maindashboard’); } Route::get(‘/maindashboard’,’[email protected]’); } –>end controller How to use controller in Folder ? Sourc..

Read more

why my old image can’t be deleted when i uploaded new image? this is my controller where i use to store data and image. my file image name is stored combination from nama_post_adps and from $imageName where that is query for getClientOriginalName(); public function update(Request $request, Adopsi $adopsi, $id) { $getParentJenisHewan = JenisHewan::where("id", $request->jenis_hewan_id)->value("nama_jenis_hewan"); $getParentRasHewan ..

Read more

const addProduct = dispatch => async (request, callback) => { try { const response = await website.post(‘v1/seller/add-product’, request).then(response => { console.log(response.data); }).catch(error => { console.log(error); alert(‘Sorry! Something went wrong.’); }); } catch (err) { alert(‘Sorry! Something went wrong.’); } } this is my button code <TouchableOpacity onPress={() => { var request=new FormData(); request.append("name", name); request.append("added_by", ..

Read more

i am trying to make the user choose if they want to upload file or not this is the controller code: $request = request(); $profileImage = $request->file(‘uploadfile’); $profileImageSaveAsName = time() . "aa" . "-profile." . $profileImage->getClientOriginalExtension(); $upload_path = ‘uploads/form1/’; $profile_image_url = $upload_path . $profileImageSaveAsName; $success = $profileImage->move($upload_path, $profileImageSaveAsName); how can i make it nullable? Source: ..

Read more

I’m a new Laravel Programmer and I tried to develop an web interface which uses the same login controller for two users which are from different tables. One user is Student and the other is Instructor. They are all routed to their intended page after login but I was wondering if there is any security ..

Read more