Category : laravel

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

please help. I got this error "Target class [FrontendController] does not exist." This is my route : <?php use IlluminateSupportFacadesRoute; Route::get(‘/’,’[email protected]’); My Controller : <?php namespace AppHttpControllers; use IlluminateHttpRequest; use DB; use AppHttpRequests; use AppHttpControllersController; class FrontendController extends Controller { public function home() { return view (‘index’); } } Why this happend? can anyone help ..

Read more

I’m trying to create a simple search for hotels with live-wire, website is multi language English and Arabic. Search works properly in English only, when I switch into Arabic, The query run properly but the returned value from database is in English. protected function current_locale() { return LaravelLocalization::getCurrentLocale() == ‘ar’ ? ‘_ar’ : ”; } ..

Read more

@component(‘mail::message’) # Hello from our blog Your password recovery code: <?php use IlluminateSupportFacadesDB; $characters = ‘0123456789’; $charactersLength = strlen($characters); $randomString = ”; for ($i = 0; $i < 3; $i++) { $randomString .= $characters[rand(0, $charactersLength – 1)]; } AppModelsRegistration::where(’email’, ‘=’, $_SESSION[’email’])->update([‘recovery_code’ => $randomString]); echo $randomString; ?><br><br> Blog @endcomponent So this is my recovery email (it’s ..

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

Strange issue with Laravel ID generator. I want to add a custom ID field in my orders table and I have this boot method in the model: public static function boot() { parent::boot(); self::creating(function ($model) { $model->order_number = IdGenerator::generate([‘table’ => ‘orders’, ‘length’ => 6, ‘prefix’ => date(‘y’)]); }); } This works and creates IDs like ..

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 am developing with Laravel 8.4 ("laravel/framework": "^8.40") and Voyager 1.4 ("tcg/voyager": "^1.4"). I am facing an unusual bug with Laravel Voyager. When I am activating Server-Side pagination for any BREAD, the pagination-links section is breaking as below: enter image description here enter image description here However, they are working when I am turning off ..

Read more

I want to Make a rounded corner image in laravel intervention. Please help me out. $image = Image::make($user[‘profile_pic’])->fit(300, 300, function ($constraint){ $constraint->aspectRatio(); }); $image->encode(‘png’); $width = $image->getWidth(); $height = $image->getHeight(); $mask = Image::canvas($width, $height); // draw a white circle $mask->circle(280, $width / 2, $height / 2, function ($draw) { $draw->background(‘#fff’); }); $image->mask($mask, false); $img->insert($image, ‘top-left’, ..

Read more

I want to Make a rounded corner image in laravel intervention. Please help me out. $image = Image::make($user[‘profile_pic’])->fit(300, 300, function ($constraint){ $constraint->aspectRatio(); }); $image->encode(‘png’); $width = $image->getWidth(); $height = $image->getHeight(); $mask = Image::canvas($width, $height); // draw a white circle $mask->circle(280, $width / 2, $height / 2, function ($draw) { $draw->background(‘#fff’); }); $image->mask($mask, false); $img->insert($image, ‘top-left’, ..

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