I am new to laravel.I want to schedule some task on my application using laravel 5.3.But I still run my application on localhost.Please can someone explain me to how laravel task scheduling can be done on localhost.
I assume you are using Windows.
Schedule a task to run php artisan schedule:run using the at command.
You also must make sure the php executable is in your system path: How do I add my PHP directory to the PATH on Windows?
How To Use the AT Command to Schedule Tasks
To start working with Laravel Scheduling, first, you have to run this command on the terminal.
php artisan make:command command_name
Then check the files in the directory. App\Consol\Commnads you'll have a command_name file. Edit as given in the following script.
protected $signature = 'save:file';
After that add your own methods and tasks to Handle function
At the end, run this command to check whether the scheduling is working or not.
php artisan save:file
Related
I am trying to find a solution of how to execute a JavaScript file a couple of times a day (Like Task Scheduler on Windows)
At the moment, I execute the file in VS Code or Command Prompt using node file.js.
Is there any way to automatically execute it?
I have tried the following with Task Scheduler, but is not executing the file, just opening VS Code:
Action: Start a program
Program/script: "C:\Users\AppData\Local\Programs\Microsoft VS Code\Code.exe"
Arguments: -l -i -c "C:\Users\desktop\folder_containing_the_file; node writeToFile.js"
It can't be executed when the computer is off. But you could use the Amazon AWS Free-Tier services to schedule and run it.
currently i need to work on a project using laravel and vue
i cloned the project that i need to work on from github,
the project is using vue and laravel with passport
but i'm not sure what are the commands i need to use to run the project on my local machine
do i follow the same commands like when i clone a laravel project? or there is something extra for vue?
i tried to install passport and run few commands but still facing blank page
if someone can provide the commands in order that would be much appreciate it
It's really difficult to say what commands needs to be run in your specific case, since we can't see the code. Also make sure your .env is set up correctly with database connections etc.
But generally you would need something like this.
Install packages
composer install
npm install
Create APP_KEY for Laravel
php artisan key:generate
Run migrations to create all your database tables.
php artisan migrate
Start artisan server for the Laravel backend. Default port is 8000, so you should reach it at http://localhost:8000
php artisan serve
Compile the front end files
npm run dev
But this is all guesswork. Your project could be set up different.
as the tittle said i have a lot of javascript that its not in the project, i have in the project before but now i dont use them anymore so i stop calling them in the application.js and in my test heroku server it works but in my main server its not! and i dont know why.
test server: morning-shelf-6185.herokuapp.com.
run server: www.apptrendit.com.
if you compare the 2 application.js the code are a lot different.
test server: https://morning-shelf-6185.herokuapp.com/assets/application-5c4208e2bfaa870785d03c0aa2febd5c.js
run server: https://morning-shelf-6185.herokuapp.com/assets/application-5c4208e2bfaa870785d03c0aa2febd5c.js
i use heroku for the both of them but 1 of them is a development server and the other is a master server but the 2 of them have the same code and files when i see it with my sublime text
Your problem is probably related to the assets pipeline.
You may want to run RAILS_ENV=production rake assets:precompile before deploying to your main server. If you use capistrano you can automate the process.
Everytime u make a huge change on your assets do this:
bundle exec rake assets:precompile
in local and then just add, commit and push it.
I have a website which is developed based on Node.JS and uses grunt to be run.
I want to deploy it on my aws server. So, i installed node.js and all its dependencies and modules, configured database etc, and i am able to run it from terminal.
First i used
grunt build
and then
grunt
and website is running and up without any problem.
My question is that how should i deploy these kind of websites, so it always is running and listening to the port? That is because whenever i close the terminal (Putty), it will stop working.
I tried using these commands to run it in the background but didn't work :
grunt &
alnd also
(grunt &)
but whenever i exit the terminal (putty) , web server stops working.
Can anybody please help me with that? How can i make grunt running even after closing the terminal?
And how node js + grunt websites will be deployed on the server in general?
I want to create a simple Javascript program with a HTML interface. The program will run in Chrome. I will also use node-serialport and Node.js to comunicate with an Arduino. I have a HTML and JavaScript file done, but I have no clue how to run it, or how to implement Node.js or node-serialport, nor how to "start" the sever. Initially it will only be running locally, but eventually it may become a real sever. For now, how do I run all that locally?
EDIT: I'm using the sample code from http://brandontilley.com/2012/03/02/controlling-an-arduino-from-nodejs.html, with the CoffeeScript converted into JavaScript.
Lucas, glad you found the blog post useful; perhaps I should add this information to it.
Getting the sketch into your Arduino
Just fire up the Arduino application, paste in the sketch code, and hit "Upload." Should be all you need to do here.
Starting the Node.js Server
What operating system are you using this on? Finding out how to access your Arduino microcontroller via node-serialport will differ based on your OS.
In the source code, change the string value of port to be your Arduino's device (once you know it). Also, the script depends on Express and (of course) node-serialport from NPM, so run npm install express serialport in the directory where your JavaScript file is saved. Finally, run the file with node server.js (assuming server.js is the name of your file). Then you can access the server at http://localhost:8080.
You can use node.js to serve up HTML with Express. If your main Javascript file is called server.js, then run it by typing:
node server.js
at the command line.