new view under vendor/mail/html not found - laravel

I have message.blade.php file under vendor/mail/html and it works correctly. then I want to customize this file and create another view that called "message-with-bg.blade.php" but I get "view not found" error. How to add a new file under vendor/mail/html correctly?

first, did you run the command below, so that you are editing views inside your resources/views folder and not actual vendor folder? You should never change your actual vendor folder, because changes will be removed the next time you run any composer command, or run the code on different machine.
php artisan vendor:publish --tag=laravel-mail
After that, you would need to edit the build function inside your Mail class, like:
public function build()
{
return $this->view('emails.message-with-bg');
}

Related

View [layouts.app] not found in laravel

I have created an application in laravel using appzcoder crud-generator plug-in. i have done everything accordingly but i am getting the above mentioned error. I have a folder named layouts in views folder and this folder has app.stub in it. but when i run the project it gives the following error
View [layouts.app] not found. (View:C:\wamp64\www\myProject\resources\views\admin\items\index.blade.php)
make sure you have run below code if not run it will create layout.app path
or manually create view/layout/app.php
php artisan vendor:publish --provider="Appzcoder\CrudGenerator\CrudGeneratorServiceProvider"

How to create symlink from public/storage to storage/app/public in laravel?

I have no idea on how to create symbolic link or symlink.
I am working on File system in laravel 5.2.
The document says that i need to create a symbolic link from public/storage to storage/app/public to keep the publicly accessible files in one directory.
How to create that symlink or symbolic link?
Which file or directory should I place that code?
App::make('files')->link(storage_path('app/public'), public_path('storage'));
And don't forget to use App after namespace.
Run this command:
php artisan storage:link
In a Windows environment, you can:
cmd with Run as administrator
Run the mklink command:
mklink /D "C:\xampp\htdocs\xxxx\yyy\public\storage\"
"C:\xampp\htdocs\xxxx\xxx\storage\public\"
On Shared Server, where one doesn't have ssh access to run
php artisan storage:link this helps me run that from a controller, the if block code section can also be placed in a Service Provider as well as suggested by #shìpu-ahamed
public function displayForm()
{
if(!file_exists(public_path('storage'))) {
\App::make('files')->link(storage_path('app/public'), public_path('storage'));
}
return view('admin.index');
}
Added same code but still getting issue.
Method link does not exist.
currently i am adding link in my controller constructor.
here is code:
public function index()
{
$shots=[];
App::make('files')->link(storage_path('app\public'), public_path('..\public\storage'));
return View::make('adminpages.index',['shots'=>$shots]);
}

Laravel 5.1 remove controller

I have simple question on Laravel 5.1. I have created a controller using php artisan command:
php artisan make:controller PageSettings
However it was mistake, because I really wanted to create this controller in Admin folder like this:
php artisan make:controller Admin/PageSettings
Now I want to get rid of my old PageSettings controller. Is it ok just to delete my old PageSettings.php manualy? Or there is something more what needs to be done?
If you only created it and found that you did it wrong, you can manually remove the file and that's it. However when you already added routes to this controller in routes.php you should remove them from routes.php file or alter the file to reflect your new controller.
It is OK to manually delete controller. Just check routes.php if you have some route to that controller and delete it also.
I had an issue with just deleting the file. I tried running my PHPUnit test suite and got an error that looked like this:
Warning: include(): Failed opening '/user/home/me/some/file.php' for inclusion (include_path='.:') in /usr/home/me/some/vendor/composer/ClassLoader.php on line 444
I had to run composer update then composer dump-autoload. After that, everything worked just fine.
Yeah, you can delete manually without tension.
I will suggest you for avoiding more mistakes, you "phpStrom" software, from using this, if you delete manually any file from by click right of mouse->Refactor->safe delete then before deleting they will give all places which were using your file. by clicking "do refactor" you can delete it.

Laravel 4 (4.2.8) Generate model in app folder and not model

When I run this command
php artisan generate:model Post
it generates the Post.php at app/Post.php and not in model. What I am doing wrong?
You can force the path by adding path option
Try this
php artisan generate:model Post --path=app/models
The reason it is placing new file in app directory is because you must have edited the path in your config file.
See more about configurations

How can I push my package's assets into root directory?

I have a package with some assets.
vendor/package/src/assets/css|js|img etc.
How can I move those assets into root directory after installation or updating?
Also, the second question is, can I do this task with PHP? For example:
Route::get('update/{package_name}', function() {
//Trigger composer here
});
Thank you.
there is an artisan command for that
php artisan asset:publish vendor/package
for this to properly work, you'd need to put your assets into a public folder within your vendor package like vendor/package/public/(css|js|img|...) and everything will be published to your root under public/packages/vendor/package/(css|js|img|...).
you can specify a path from the root, if you're not using the public folder:
php artisan asset:publish vendor/package --path="vendor/vendorname/package/src/assets"
docs: http://laravel.com/docs/packages#package-assets (although the path parameter is not mentioned there)
I think what he wants is a different destination folder not the source folder. --path is useful when you have a different source folder I believe.

Resources