File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,8 +73,13 @@ final protected function view(?string $view, array $data = []): string
7373
7474 // If no view is specified, we'll try to guess it based on the class name.
7575 if (empty ($ view )) {
76- $ view = decamelize ((new ReflectionClass ($ this ))->getShortName ());
77- $ view = str_replace ('_cell ' , '' , $ view );
76+ // According to the docs, the name of the view file should be the
77+ // snake_cased version of the cell's class name, but for backward
78+ // compactibility, the name also accepts '_cell' being omitted.
79+ $ ref = new ReflectionClass ($ this );
80+ $ view = decamelize ($ ref ->getShortName ());
81+ $ viewPath = dirname ($ ref ->getFileName ()) . DIRECTORY_SEPARATOR . $ view . '.php ' ;
82+ $ view = file_exists ($ viewPath ) ? $ viewPath : str_replace ('_cell ' , '' , $ view );
7883 }
7984
8085 // Locate our view, preferring the directory of the class.
You can’t perform that action at this time.
0 commit comments