#### Category : php

How can I compare two words and check if they’re of the same meaning in Php. Any idea because I’m working on a project that’ll require that but I have no idea how to go about it Sourc..

i am having the error stated above, and here is the copy log php artisan db:seed BadMethodCallException Call to undefined method AppModelsCategory::factory() at vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:50 46▕ * @throws BadMethodCallException 47▕ */ 48▕ protected static function throwBadMethodCallException($method) 49▕ { ➜ 50▕ throw new BadMethodCallException(sprintf( 51▕ ‘Call to undefined method %s::%s()’, static::class,$method 52▕ )); 53▕ } 54▕ ..

I am editing the next error while printing a model content on my blade.php view: And this is how i’m trying to use it on my view: blade.php <div class="form-group"> <label for="color">انتخاب رنگ</label> @if(!$product->colors) <div id="showColors"> </div> @else <div class="row no-gutters mb-1"> <div class="col-md-3"> <label for="color_name" class="ml-1">نام رنگ:</label> <input type="text" id="color_name" name="color_name[]" class="form-control w-auto d-inline" .. Read more I am developing a project with Laravel 8. There are fields such as "us_name", "us_surname" in my Users table. After the user is logged in, I can reach these values by saying "auth()->user()->us_name" etc. So far, no problem. What I want to do is add some values here that are not in my table. For .. Read more I am trying to add Watermark of 800x100px to Images which can have any resolution greater than 800×100, i.e. 801×110, 1200×1000, 1300×200, 1920×1080, 4000×2010, etc. I want to keep the aspect ratio of Watermark and image to 2:50. i.e., if image has 1000px width, then watarmark over image should occupy 20px(1000/50). Here is my Function .. Read more I am redirecting to a named route in Laravel 7 and instead of the route being redirected it returns the user to the previous page. Controller return redirect()->route(‘NAMEDRoute’)->with("Information",$information[0]); web.php Route::get(‘/x/y’, "[email protected]")->name(‘NAMEDRoute’); This just returns me to the route I was on before, I have tested other routes that also work but the function that ..

I am integrating Razorpay API to my Web App coded in PHP Laravel. I have 2 files – RazorpayController.php public function create($profile = null, Request$request){ $details = json_decode($request->details); return view(‘profile.payment.razorPay’, [‘profile’ => $this->profile, ‘details’ =>$details, ‘total’ => $total, ‘data’ =>$data]); } public function verify($profile = null, Request$request){ $orders = [‘details’ => .. Read more I have stored images in the public folder and access them via API calls. Every time it takes the same amount of time to load those images. It is a very annoying thing. So I need to cache those images without using any external libraries. Sourc.. Read more public function createall() {$users = User::orderBy(‘id’, ‘ASC’) ->where(‘server’, ‘Demo’) ->where(‘enable’, ‘1’) ->where(‘mt4_account’, ‘!=’, 0) ->take(4) ->get(); foreach ($users as$user) { $server = Server::where(‘Serverdesc’,$user->server)->first(); $post = [ ‘server’ =>$server->serverdesc, ‘api_key’ => ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’, ‘login’ => intval($user->mt4_account), ];$datapost = json_encode($post); // initialize cURL$ch = curl_init(); // set options curl_setopt($ch, CURLOPT_URL, "http://xxxxxxxxxxxxxxxxx/closetrades"); curl_setopt($ch, ..

I want to pass an additional parameter from controller to collection resource, Please have a look at the following code, I don’t know why It’s not working. I might be doing something wron here, please help Controller $batchStudents =$batch->students->except($batch->host->id);$batchStudents->test = ‘This is testing’; $students = UserCollection::collection($batchStudents); Collection: class UserCollection extends JsonResource { return ..

so I’m relatively new to laravel and am trying to understand it. So far it has been good but I’ve been stuck at an error for a while now so any help would be appreciated. I’m trying to follow along with a youtube tutorial (not sure if links are allowed) and this is what I’m ..

I am working on a meal planning application in Laravel, and one of the functionality is to have meal plans that are past their end date move to an ‘Archives’ page (stored in a new MealPlan_Archives table and displayed on a different page). Both MealPlanDisplay table and MealPlan_Archives have the exact same table columns, except ..

I am learning laravel 8, I keep getting this error BadMethodCallException Call to undefined method AppModelsQuestion::factory() at C:UsersUSERDesktoplaravelsqnavendorlaravelframeworksrcIlluminateSupportTraitsForwardsCalls.php:50 46▕ * @throws BadMethodCallException 47▕ */ 48▕ protected static function throwBadMethodCallException($method) 49▕ { ➜ 50▕ throw new BadMethodCallException(sprintf( 51▕ ‘Call to undefined method %s::%s()’, static::class,$method 52▕ )); 53▕ } 54▕ } • Bad Method Call: Did ..

laravel requires a reporting tool to generate printable , PDF reports with grouped by features . I have tried koolreport report tool but not supporting PDF export and CSS support for layouts. Is there any other solution for LARAVEL for generating reports, charts and printable pdf exports. I want to make highspeed receipt printing also ..

Here is my controller method public function exportCommitmentsToCsv(ConversationInstance $conversation_instance) {$this->authorize(‘exportCommitments’, $conversation_instance);$commitments = $conversation_instance->commitmentTable2();$commitment_arr = json_decode(json_encode($commitments), true);$header_row = [ ‘Firm Name’, ‘Client Name’, ‘Full Name’, ‘Title’, ‘Session Commitment Duration’, ‘Live id’, ‘Session Date’, ‘Program Name’, ‘Topic Name’, ‘Commitment id’, ‘Conversation Instance id’, ‘User id’, ‘Program id’, ‘Program Topic id’, ‘Commitment Creation Date’, ..

I have table ‘transaction_items’ in my dtaabse that looks similar to this… id transaction_id qty unit_price 1 100 1 10.00 1 100 2 10.00 1 100 3 10.00 1 200 1 20.00 1 200 1 20.00 1 300 1 15.00 Current I fetch the data: $data[‘transaction_items’] = DB::table(‘transaction_items’)->get(); and run a foreach loop: foreach ($transaction_items ..

Consider 2 attributes one is color and size, onclick automatically it should create all combinations like: attribute1: color- blue, green, white attribute2: size- S,L,M ->Blue-S, Blue-L, Blue-M, similarly rest of the combinations. Sourc..

I’m using LaravelExcel to export some data from View into an Excel file (csv). So here is my Export Class: namespace AppExports; use AppMemberStudent; use IlluminateContractsViewView; use MaatwebsiteExcelConcernsFromView; use MaatwebsiteExcelFacadesExcel; class StudentExportView implements FromView { /** * @return IlluminateSupportCollection */ public function view(): View { return view(‘admin.students.custom’, [ ‘students’ => Student::where(‘mbr_id’, ‘<=’, 0)->paginate(15), ‘customs’ => ..

I am working with Laravel 5.8 with PHP version of 7.4 to develop my project, and in this project, I wanted to make an Excel file out of a table called students from View. So here is what I did: I typed composer require maatwebsite/excel at the Terminal and downloaded the package. I added MaatwebsiteExcelExcelServiceProvider::class, ..

I am working with Laravel 5.8 with PHP version of 7.4 to develop my project, and in this project, I wanted to make an Excel file out of a table called students. So here is what I did: I typed composer require maatwebsite/excel at the Terminal and downloaded the package. I added MaatwebsiteExcelExcelServiceProvider::class, in providers ..

I have this Category List where i’m creating menu planner this code is working and the output of this code is given below, $categoryList=Category::where(‘user_id’,$id)->get(); $meal_day=array(‘1’=>’Monday’,’2’=>’Tuesday’,’3’=>’Wednesday’,’4’=>’Thursday’,’5’=>’Friday’,’6’=>’Saturday’,’7’=>’Sunday’);$meal_plan=[]; $i= 0; foreach($categoryList as $catKey =>$row) { for($k=1;$k<=count($meal_day);$k++) { $menuPlanner=MenuPlanner::where([‘day’=>$k,’user_id’=>auth()->user()->id,’category_id’=>$row[‘id’]])->first(); if($menuPlanner) { $product = Product::where([‘id’=>$menuPlanner->product_id])->first(); $meal_plan[$catKey][$k][‘product_title’]=$product->title; } } } Output: array:2 [ 0 => array:7 [ 1 => ..
I´m traying to generate pdf from blade in laravel 5.6 with this code: $view = View::make(‘pdf.precontrato’,compact(‘precontrato’));$html = $view->render();$pdf = new TCPDF(); $pdf::SetTitle(‘precontrato’);$pdf::AddPage(); $pdf::writeHTML($html, true, false, true, false, ”); $pdf::Output(‘precontrato.pdf’); it´s the first time that i´m using this library, but i need create pdf from this view that it´s created. (I´m modifying exists .. Read more I have a master blade template and a component. I tried to include my stylesheet only for my component, not the whole template how can I do that? My attempt was using @stack as described here view/layouts/master.blade.php <head> … … @stack(‘styles’) </head> view/books/index.blade.php … … @push(‘styles’) <link href="{{ asset(css/styles.css) }}" rel="stylesheet"> @endpush … … Source: .. Read more I’m using Laravel 5.8 to develop my project and in this project, I have a OneToMany relationship between Member Model & Student Model like this: Student.php: public function member() { return$this->belongsTo(Student::class, ‘std_mbr_id’); } Member.php: public function student() { return $this->hasOne(Student::class,’std_mbr_id’); } Then at the Controller, I added this: public function index() {$student = ..