Category : php

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

Read more

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

Read more

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

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

Read more

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

Read more

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

Read more

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

Read more

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

Read more

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

Read more

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

Read more

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

Read more

We’ve developed a Laravel application to insert/update the products in Shopify. For that, We are calling the shopify API’s using curl. Sometimes, few products are not getting inserted/updated because of this open ssl issue php_error: "cURL error 35: OpenSSL SSL_connect: Connection reset by peer in connection to domain:443. If we try to upload those remaining ..

Read more

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

Read more