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 ..

Read more

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 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 ..

Read more

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 ..

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: ..

Read more

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; ..

Read more

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

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

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, ..

Read more

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 ..

Read more