Category : laravel

This url after i am filtering data using date (wherebetween) http://127.0.0.1:8000/viewMonth/filter?_token=9jmqgiLCKNTMKtwObhlVQXCR6Vj1zcrDwsdXDDbm&dateFrom=2022-01-17&dateTo=2022-01-17 Now I am making a new function called SearchData, how i suppose to do if i want to display SearchData from the filtered date http://127.0.0.1:8000/viewMonth/filter?_token=9jmqgiLCKNTMKtwObhlVQXCR6Vj1zcrDwsdXDDbm&dateFrom=2022-01-17&dateTo=2022-01-17/{SearchData} And this is my route Route::get(‘/viewMonth/filter/search’, ‘[email protected]’)->name(‘SearchReportMonth’); Route::get(‘/viewMonth/filter’, ‘[email protected]’)->name(‘filterDateMonth’); Sourc..

Read more

I’m working on a Laravel 8 Project with Sanctum and VueJs, and I would like to know if there is any way to send the token without write each time header in my axios request: const token = localStorage.getItem("token"); axios .get("/api/endpoint/", { headers: { "Content-Type": "application/json", Authorization: "Bearer " + token } }) .then(response => ..

Read more

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

My Laravel API is hosted on godaddy and I am call that API from localhost. Here is $.ajax({ url: ‘https://example.com/api/ali’, method: ‘POST’, data: { image: dataURL, patientname: $(‘.patientname’).attr(‘patientname’), phone: phonenum, mrid: $(‘.patientmrid’).attr(‘mrid’), }, success: function(response) { $(".btnsave").text(‘Send message’); if(response == "success"){ $(‘.alert-success’).fadeIn(300).delay(5000).fadeOut(1000); }else if(response == "notsaved"){ $(‘.alert-danger’).fadeIn(300).delay(5000).fadeOut(1000); }else if(response == "notsent"){ $(‘.alert-danger’).fadeIn(300).delay(50000).fadeOut(1000); } }, error: ..

Read more

I want to setup a small file of cURL requests so I can quickly test my Laravel app’s API quickly. Unfortunately, I’m stuck at logging in :D. This is what I have so far: curl -H "Accept: application/json" -d @./curl/user.json http://localhost:8000/login -o ./curl/response.json -v I have a user.json file that has my login info: { ..

Read more

im trying to get the latest data on database, im using this on my views : @foreach ($shows as $s) <tbody> <tr> <th scope="row">{{$loop->iteration}}</th> <td>{{$s->nama}}</td> <td>{{$s->umur}}</td> <td>{{$s->alamat}}</td> <td>{{$s->nama_ortu}}</td> <td>{{$s->posyandu}}</td> <td>{{$s->result}}</td> </tr> </tbody> @endforeach and on controller : public function showresultpasien() { $shows = DB::table(‘pasiens’)->orderBy(‘id’, ‘DESC’)->first(); return view(‘result’, compact(‘shows’)); } did i doin something wrong ? ..

Read more

I have such a problem with Laravel. I write different data during user registration in several tables. Then when the user logs in to their account, they have to pay the amount. The data that the user has filled in and already exists in the database must then be transferred to another database. The problem ..

Read more

Im trying to figure out how to call function from controller. When I call this in blade php its working fine Todo::where(‘is_done’, false)->count(); But Im trying to make less mess in blade php and call it like {{ Todo::isDone(); }} What im trying in controller is public static function isDone() { return Todo::where(‘is_done’, false)->count(); } ..

Read more

I’m throwing an exception like this: use IlluminateAuthAccessAuthorizationException; class MyMiddleware { public function handle(Request $request, Closure $next, …$guards) { …. throw new AuthorizationException(); } } The exception is succcessfully thrown as expected but it doesn’t hit the laravel.log file, nor it doesn’t hit Exceptions/Handle.php Any idea why? Thanks. Sourc..

Read more

i have collection like this: array:13 [▼ "id" => 1 "sport_id" => 1 "section_id" => 1 "slug" => "northern-ireland-premiership" "name_translations" => array:2 [▶] "has_logo" => true "logo" => "https://tipsscore.com/resb/league/northern-ireland-premiership.png" "start_date" => "2021-08-27 18:45:00" "end_date" => "2022-03-26 23:59:00" "priority" => 0 "host" => array:2 [▶] "tennis_points" => 0 "facts" => array:6 [▶] ] i want to ..

Read more

I try to refactor my codes. my question is that how can I refactor a method that save data in several table in the same time? I think writing these codes is essential. In the other hand, it is too long for method in controller. can I transport some of them to Model? I have ..

Read more

I have following tables :- Content(id,request_id,created_at,created_by (FK)) Users(id,username,is_admin,is_supervisor,is_supervisee) Supervisee(id,user_id(FK),assigned_supervisor(FK),created_at,updated_at) Content can be posted by user which is either admin or supervisee. Supervisee can have many assigned supervisors. Admin can also act as supervisor, but not vice versa. Below are the relations among tables:- Content.php public function user(){ return $this->belongsTo(‘AppUser’)->select([‘id’,’username’]); } User.php public function assigned_supervisors() { ..

Read more