skip to Main Content

Splitting Paginated Blade – Laravel

Below is my controller code $category_ids = array(); foreach($categories as $category){ $category_ids[] = $category->id; } $paginated_products = Product::where('status',1)->whereIn('category_id',$category_ids)->latest()->paginate(30); Below is my blade view code $first_ten_products = array_slice($paginated_products,0,9); But am getting the error below how can i fix it. Thanks array_slice():…

VIEW QUESTION

Laravel model create() and fill() methods doesn't work

I have the following model: <?php namespace AppModels; use IlluminateDatabaseEloquentModel; class Review extends Model { protected $fillable = ['*']; public $dates = ['page_available_untill']; public static function findByUUID(string $uuid): self|null { return self::where('page_uuid', $uuid)->get()->first(); } } Model seeder: <?php use IlluminateDatabaseSeeder;…

VIEW QUESTION

assertSee failed due to whitespaces in html code – Laravel

In my blade, I have a button: <a href="/customer/member/delete/{{ $member->id }}" class="btn btn-secondary delete-button" > Delete </a> And I want to test it: $this->view->assertSee('<a href="/customer/member/delete/1" class="btn btn-secondary delete-button">Delete</a>'); How can I ignore whitespaces in the test? A tried: trim and…

VIEW QUESTION
Back To Top
Search