#### Category : controller

I am trying to create a first application using TCPDF and Laravel 8. I have an initial page which has a listing of users from a MySQL table and two buttons (Download PDF and View PDF) There are three routes setup in my web.php file: Route::get(‘/’, ‘[email protected]’); Route::get(‘download’, ‘[email protected]’)->name(‘download’); Route::get(‘viewpdf’, ‘[email protected]’)->name(‘viewpdf’); I have tried creating ..

I’m new to Laravel. Can anyone please let me know how to use "AS" operator for table ‘products’ in below SQL query? $obj = new Product();$main_data = $obj ->select(‘products.*’,’t2.title’) ->leftJoin(‘category as t2’, ‘t2.id’, ‘=’, ‘products.subcategory_id’) ->where(‘products.status’,1); Sourc.. Read more Table: this is the table being used from the SQL database (id is auto incremented) Array: then output below is from the console of the browser after adding in: dd($replies); The screenshot below shows the input of the ui, which is the same data registered in the array in the screenshot above Entities: The function ..

i am making a search for the website so the user can search for results from database everything is working fine but how can i hide results until the user complete the search? this is the controller: class SearchController extends Controller { public function search(Request $request){ // Get the search value from the request$search ..

I try to pass in other view but it gve me page not founded this is my form: <form class="d-flex flex-column flex-md-row border rounded mr-10 p-4" method="post" action="{{ route(‘stageaire.index_S’, [‘id’ => $an[‘id’] ]) }}"> @csrf …. this is my web.php: Route::post(‘/inscriptionS/{id}?’, [StageaireController::class, ‘index_S’])->name(‘stageaire.index_S’); this is controller: public function index_S(Request$request){ dd(‘index’); $idAnnonce =$request->id; $villes .. Read more I’m using voyager admin panel. I want to check the attributes that are changed when I submit the form. I’m using isDirty() & getDirty() but that is not working. It is showing that the error Method IlluminateHttpRequest::isDirty does not exist. Sometimes showing this error. Call to a member function isDirty() on string update Controller public .. Read more So I have a parameter called$contest->id, I want to pass it in this query but in controller laravel 8. But, I’m getting an error that says A non-numeric value encountered $scoreboard = DB::select(DB::raw(" select t.id as id_tim, t.nama as team_name, (select nomor from prg_questions where prg_contest_id = " +$contest->id + " ), (select ..

I have name is Bildirim_Islemleri.php php file on laravel public directory.I need call Controller in this php file.And return cath error to insert log table.How can ı do this?Do you have any ideas? Im sharing directory stcuture and code.I trying this process in last from function OdemeBildir controller directory structure php file structure enter image ..

So basicly i want to pass data from controller with this following code: $scoreboard = DB::table("teams") ->selectRaw( ‘teams.id AS "team_id", teams.nama AS "team_name", COUNT(*) AS "jumlah_accepted", sum(prg_submissions.skor) AS "time" from prg_submissions inner join teams on prg_submissions.team_id = teams.id where prg_submissions.status = "Accepted" and prg_submissions.prg_question_id in (select id from prg_questions where prg_questions.prg_contest_id = ‘ .$contest->id ..

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; So i’m trying to access database through controller in laravel 8. Usually im using eloquent but due to a complex syntax im using DB Raw and getting this error. Is anyone know how to fix this? public function show_scoreboard(PrgContests $contest, .. Read more I am having an issue where I want to edit an item in my inventory list and am able to click on the edit button but nothing happens in the browser. I am confused as to why that is. Any thoughts would be very helpful. My controller: <?php namespace AppHttpControllers; use AppModelsInventory; use IlluminateHttpRequest; /** .. Read more namespace AppHttpControllers; use IlluminateHttpRequest; class PostsController extends Controller { public function __construct() {$this->middleware(‘auth’); } public function create() { return view(‘posts/create’); } public function store(Request $request) {$this->validate($request, [ ‘caption’ => ‘required’, ‘image’ => ‘required|mimes:jpeg,png,jpg,gif,svg|max:2048’, ]);$imagePath = request(‘image’)->store(‘uploads’, ‘public’); auth()->user()->posts()->create([ ‘caption’ => $this[‘captions’], ‘image’ =>$imagePath, ]); return redirect(‘/profile/’ . auth()->user->id); } } Source: ..

I am new to Laravel and something I have not understood is why the routes can be declared as a string. I think there is a good reason behind it just I don´t get it. Could someone explain it? The two ways I found to declare a route using a controller in Laravel. First: Route::get(‘hello’, ..

I have an app using Laravel 8 as backend. I already have auth process using a custom table named "accounts" and I want to use some social login process, starting with facebook. The thing is I facing some problems coding it. My controller isn’t redirecting correctly to facebook and returning {"data": null, "error": null}. I ..

I have a router web.php and two controllers. One is HomeController with my index/homepage, and the other is InventoryController with a randomly generated database. I am currently getting an error when I run it on localhost that there is a "Reflection Exception and that the Function() does no exist". My router web.php: <?php use IlluminateSupportFacadesRoute; ..

public function store(Request $request) {$request->validate([ ‘title’ => ‘required’, ‘description’ => ‘required’, ]); User::create($request->all()); return redirect()->route(‘Users.index’) ->with(‘success’,’User created successfully.’); } it is a resource controller , if there is a image that I want to upload I usually do this– public function store(Request$request) { $slider=new Slider();$message="Slider not added successfully"; $slider->heading =$request->input(‘heading’); $slider->description .. Read more i have this route: Route::group([‘prefix’ => ‘comments’, ‘middleware’ => [‘auth:api’]], function(){ Route::delete(‘/delete/{id}’, [CommentController::class, ‘destroy’])->name(‘comment.delete’); }); in my controller i have public function destroy(Comments$comments) { dd($comments); } normally i must have the data of respective of the id right? but instead i got empty instance of the model Sourc.. Read more I have spent my time almost two hours more to find solution and try finding reference in the internet, but i am not find yet as i want. I have problem, my problem is i want to store data from form base on block i have make, in this case i have make 6 block .. Read more In Laravel I use Novay WordTemplate to generate a generated word template. I took the code from github https://github.com/novay/laravel-word-template. But I have a problem when I want to move the function to the Controller. I move in the following way: On my Route fill like this: Route::get(‘/word’, [WordController::class, ‘word’])->name(‘word’); Then in the controller I made .. Read more I am a beginner in the Laravel framework, and I am having some trouble trying to store the data that was inserted in a form into a Collection. This is the form where you get the data <form action="{{ url(‘/add_client’) }}" method="POST"> @csrf <table> <tr> <td><input type="text" placeholder="Add Client" name="client" required></td> <td><input type="submit" value="+"></td> </tr> .. Read more I am new to laravel 8 framework, I am working on controllers subfolders, but i am not able to access my Controller file. My Controller which is i am accessing is inside the Controllers/APIControllers folder with name LoginController.php path is Controllers/APIControllers/LoginController Please help me to find best solution. Below is my code. api.php <?php use .. Read more I am new to laravel 8 framework, I am working on controllers subfolders, but i am not able to access my Controller file. My Controller which is i am accessing is inside the Controllers/APIControllers folder with name LoginController.php path is Controllers/APIControllers/LoginController Please help me to find best solution. Below is my code. api.php <?php use .. Read more public function searchByDate(Request$request) { $sale = DB::table(‘sales’) ->join("customers", ‘sales.customer_id’, ‘=’, ‘customers.id’) ->where(‘sales.created_at’, ‘=’,$request->created_at) ->select(‘sales.*’, ‘customers.name’) ->get(); return response()->json($sale); } I want to compare two dates at where condition but there is DateTime both in sales.created_at so I want to get an only date from it so that I can compare it with$request->creates_at, ..
I am new to Laravel. I am using registerController in Laravel to create users . Users data are stored in Users table. What I have tried is : @extends(‘adminlte::auth.auth-page’, [‘auth_type’ => ‘register’]) @php( $login_url = View::getSection(‘login_url’) ?? config(‘adminlte.login_url’, ‘login’) ) @php($register_url = View::getSection(‘register_url’) ?? config(‘adminlte.register_url’, ‘register’) ) @if (config(‘adminlte.use_route_url’, false)) @php( $login_url =$login_url ..