Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

263
Views
How to create a file in resource/view directory Laravel

I am using Laravel 5.0 and I am trying to create a view if is does not exits like so

if (view()->exists($moduleName.$getCategoryNameToLowerCase))
    {
        //if exist return the view
         return view($moduleName.$getCategoryNameToLowerCase);
    }
    else{
         //else create a view and return it;
         fopen( app_path('../resources/','views/'.$moduleName .'.'. $getCategoryNameToLowerCase . '.blade.php' ), 'w');
         return view($moduleName.$getCategoryNameToLowerCase);
    }

But I dont know why I am still not able to go one folder backwards to reach the resource folder it still says this

fopen(C:\xampp\htdocs\foobar\app/../resources/): failed to open stream: No such file or directory
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Why use app_path, you can use base_path instead

https://laravel.com/docs/5.4/helpers#method-base-path

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!