Closed rafatrace closed 8 years ago
I'm struggling to reproduce your issue. I've created a test here and it seems to work as expected.
"view11" extends "base-alt" which is in a different path that has been added using addpath()
.
Can you put up a small example repo with the code demonstrating the issue?
I was implementing this in a wrong way, my bad. Another thing, is there a way to delete paths or does this happens automatically?
Imagine my situation: I have, UsersController, BooksController and AuthorsController, on everyone one of this I'm adding paths for each controllers, since users views are stores in a different path, like in the example above.
If I go to users, then books, then authors my paths array will have this 3 paths to search for blade files in it. If I go to users again will it add Users path again, and make 4 paths on the array?
What about a deletePath method? I mean, it will be less consumable if when I'm going to users controller it will search views only in users path instead of going to author path, then to books and finally to the users. Maybe your class does this already and I didn't find it.
Thanks for your time and work.
The paths are managed by the underlying project and they don't offer any kind of deletePath.
You could create a copy of your blade instance to pass to your controller, then adding the controller specific path wouldn't affect the parent instance, something like:
$blade = new BladeInstance;
$blade->addPath("default");
$usersBlade = clone $blade;
$usersBlade->addPath("users");
That seem like a nice implementation to my use case. Thanks again @duncan3dc
Cheers
Hi, imagine the following folders structure
I've added booth
app/layouts/
andapp/packages/
to the Blade instance. When I renderproducts.list
without extending it works fine, as well as if I rendermaster
orlogin
.But when I try to
@extends('master')
inlist.blade.php
it doesn't work because it will look only in that folder that it is already in. For example in users folder only.How can you achieve this? Cheers.