Category : crud

Each user has a role. When creating a new user form the admin panel, I am not able to create a user with any role id other than 2 i.e. customer. This is my controller function: public function store(UsersRequest $request) { // if(trim($request->password) == ”){ $input = $request->except(‘password’); } else{ $input = $request->all(); $input[‘password’] = ..

Read more

I’m trying to refactor my code to be more reusable. I created a trait CrudControllerTrait to implement the index,show,store,update,destroy methods. But I found 2 problems: BrandController.php public function store(BrandNewRequest $request) { $requestData = $request->validated(); return new BrandResource($this->brands->store($requestData)); } ProductController.php public function store(ProductNewRequest $request) { $requestData = $request->validated(); return new ProductResource($this->products->store($requestData)); } The trait method would ..

Read more

I ask for solutions or suggestions regarding my program. here I try to update the ticket table. however, when I try to debug with json_encode it is empty and there is no change in the update RequestActionController public function update(Request $request) { DB::table(‘ticket’)->where(‘id’,$request->id)->update([ ‘namacust’ => $request->namacust, ‘daerah’ => $request->daerah, ‘alamat’ => $request->alamat, ‘notlp’ => $request->notlp, ..

Read more

im making an edit section on my laravel crud project. that when i press edit, it will redirect to the edit.blade.php which will call the slug instead their id. i have worked on it and it shows the error that Too few arguments to function AppHttpControllersProductController::edit(), 1 passed and exactly 2 expected my Route Route::get(‘edit/{slug}’, ..

Read more

I had a problem with Crud Form in this discussion. I will send 4 photos of the code and execution. :: Create.blade.php codes http://s15.picofile.com/file/8409172650/1.JPG :: Codes :: PostsConteroller http://s14.picofile.com/file/8409172676/2.JPG :: Codes :: Web.php http://s14.picofile.com/file/8409172692/3.JPG :: Execute page code cms.test / posts / create http://s15.picofile.com/file/8409172718/4.JPG Please send the answer a bit faster than normal. Be clear ..

Read more

I am trying to retrieve data from the database in Laravel 8. But I am getting 500 server errors and 404 errors. Here, I have included my codes: controller: <?php namespace AppHttpControllers; use IlluminateHttpRequest; use DB; use AppHttpRequests; use AppHttpControllersController; class productController extends Controller { public function index() { $users = DB::select(‘select * from products’); ..

Read more

I’ve got 2 tables with one to many relationship. portfolios id category_id status image portfolios_lang id portfolio_id title text lang I used backpack crud for portfolios_lang and I was able to create records. I added my logic to store() in my PortfolioLangCrudController. But when I want to update a record I can’t make it so ..

Read more

I use Laravel 8 inertia and vue I want to update a post and I use this component in a main vue <template> <div class="container p-3 bg-green-600 flex flex-col"> <div class="mb-8 text-2xl">{{ current_post.title }}</div> <div v-if="!edit" id="mode-display"> <div v-html="compiledMarkdown" class="text-gray-700"></div> </div> <div v-else id="mode-edit"> <form class="flex flex-col" @submit.prevent="updatePost"> <input type="hidden" name="id" id="id" v-model="current_post.id"> <button type="submit">Mettre ..

Read more

I’m create CRUD app. But when i coding in method store . I have problem , I’m try to create variable $contact = new Contact(). It’s message :Undefined type ‘AppContact’ This ContactController.php ues AppContact; …. public function store(Request $request) { $request->validate([ ‘first_name’=>’required’, ‘last_name’=>’required’, ’email’=>’required’ ]); $contact = new Contact([ ‘first_name’ => $request->get(‘first_name’), ‘last_name’ => $request->get(‘last_name’), ..

Read more

I’m creating a CRUD app. But when I code in method store I have a problem: I’m trying to create a variable $contact = new Contact(). It’s message: Undefined type ‘AppContact’. This ContactController.php use AppContact; …. public function store(Request $request) { $request->validate([ ‘first_name’=>’required’, ‘last_name’=>’required’, ’email’=>’required’ ]); $contact = new Contact([ ‘first_name’ => $request->get(‘first_name’), ‘last_name’ => ..

Read more