Skip to content

Create your first app

Morteza Jamali edited this page Mar 13, 2020 · 4 revisions

You can easily create your own applications using AngularJS and PHP . WinWord uses MVC structure for creating applications .

We now want to create the first application using WinWord that displays a Hello world ! text .

The first step is to define your app properties inside variable $apps in file App.php .

App.php

<?php
    namespace WinWord\App;

    class App {
        public $apps = [
            [
                'name' => 'My First App' ,
                'icon' => 'icons/app.svg' ,
                'slug' => 'myfirstapp'
            ]
        ];
    }
?>
Property Description
name Application name
icon Application icon path
slug Application slug
  • Then create an AngularJS controller using CLI application . Run command below :
composer create-controller -- --js=myfirstapp

Note that controller name is similar to application slug

This command creates a file with name myfirstapp.js in resources/js path .

myfirstapp.js

import WinWord from './plugin';

WinWord.app.controller('myfirstappCtrl' , function ($scope , View) {
    // Your code is here
});
Clone this wiki locally