94 |
95 |
96 |
--------------------------------------------------------------------------------
/config/queue.php:
--------------------------------------------------------------------------------
1 | env('QUEUE_DRIVER', 'sync'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Queue Prefix
23 | |--------------------------------------------------------------------------
24 | |
25 | | If you are running multiple sites on a single server you should consider
26 | | specifying a queue prefix. This string will be prepended to the queue
27 | | names to prevent cross-talk when using certain local queue drivers.
28 | |
29 | */
30 |
31 | 'prefix' => env('QUEUE_PREFIX', ''),
32 |
33 | /*
34 | |--------------------------------------------------------------------------
35 | | Queue Connections
36 | |--------------------------------------------------------------------------
37 | |
38 | | Here you may configure the connection information for each server that
39 | | is used by your application. A default configuration has been added
40 | | for each back-end shipped with Laravel. You are free to add more.
41 | |
42 | */
43 |
44 | 'connections' => [
45 |
46 | 'sync' => [
47 | 'driver' => 'sync',
48 | ],
49 |
50 | 'database' => [
51 | 'driver' => 'database',
52 | 'table' => 'jobs',
53 | 'queue' => 'default',
54 | 'retry_after' => 90,
55 | ],
56 |
57 | 'beanstalkd' => [
58 | 'driver' => 'beanstalkd',
59 | 'host' => 'localhost',
60 | 'queue' => 'default',
61 | 'retry_after' => 90,
62 | ],
63 |
64 | 'sqs' => [
65 | 'driver' => 'sqs',
66 | 'key' => 'your-public-key',
67 | 'secret' => 'your-secret-key',
68 | 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id',
69 | 'queue' => 'your-queue-name',
70 | 'region' => 'us-east-1',
71 | ],
72 |
73 | 'redis' => [
74 | 'driver' => 'redis',
75 | 'connection' => 'default',
76 | 'queue' => 'default',
77 | 'retry_after' => 90,
78 | ],
79 |
80 | ],
81 |
82 | /*
83 | |--------------------------------------------------------------------------
84 | | Failed Queue Jobs
85 | |--------------------------------------------------------------------------
86 | |
87 | | These options configure the behavior of failed queue job logging so you
88 | | can control which database and table are used to store the jobs that
89 | | have failed. You may change them to any database / table you wish.
90 | |
91 | */
92 |
93 | 'failed' => [
94 | 'database' => env('DB_CONNECTION', 'mysql'),
95 | 'table' => 'failed_jobs',
96 | ],
97 |
98 | ];
99 |
--------------------------------------------------------------------------------
/resources/views/master.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Inventory Manger
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
26 |
27 |
63 |
64 |
65 |
66 |
67 | @yield('content')
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | @yield('scripts')
76 |
77 |
78 |
--------------------------------------------------------------------------------
/app/Vendor/cosmicjs/cosmiccurl.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/Vendor/cosmicjs/cosmicjs.php:
--------------------------------------------------------------------------------
1 | curl = new CosmicCurl();
14 | $this->config = new \stdClass();
15 | //$this->config = $config;
16 | $this->config->bucket_slug = $bucket_slug;
17 | $this->config->object_slug = $object_slug;
18 | $this->config->type_slug = $type_slug;
19 | $this->config->read_key = $read_key;
20 | $this->config->write_key = $write_key;
21 | $this->config->url = "https://api.cosmicjs.com/v1/" . $this->config->bucket_slug;
22 | $this->config->objects_url = $this->config->url . "/objects?read_key=" . $this->config->read_key;
23 | $this->config->object_type_url = $this->config->url . "/object-type/" . $this->config->type_slug . "?read_key=" . $this->config->read_key;
24 | $this->config->object_url = $this->config->url . "/object/" . $this->config->object_slug . "?read_key=" . $this->config->read_key;
25 | $this->config->media_url = $this->config->url . "/media?read_key=" . $this->config->read_key;
26 | $this->config->add_object_url = $this->config->url . "/add-object?write_key=" . $this->config->write_key;
27 | $this->config->edit_object_url = $this->config->url . "/edit-object?write_key=" . $this->config->write_key;
28 | $this->config->delete_object_url = $this->config->url . "/delete-object?write_key=" . $this->config->write_key;
29 | }
30 |
31 | // Get all objects
32 | public function getObjects() {
33 | $data = json_decode($this->curl->get($this->config->objects_url));
34 | return $data;
35 | }
36 |
37 | public function getByObjectSlug($key,$slug)
38 | {
39 | $this->config->object_by_meta_object = $this->config->url ."/object-type/" . $this->config->type_slug ."/search?metafield_key=" . $key ."&metafield_object_slug=" .$slug;
40 | $data = json_decode($this->curl->get($this->config->object_by_meta_object));
41 | return $data;
42 | }
43 |
44 | //Get all object types
45 | public function getObjectsType()
46 | {
47 | $data = json_decode($this->curl->get($this->config->object_type_url));
48 | return $data;
49 | }
50 | // Get all object
51 | public function getObject() {
52 | $data = json_decode($this->curl->get($this->config->object_url));
53 | return $data;
54 | }
55 |
56 | // Get media
57 | public function getMedia() {
58 | $data = json_decode($this->curl->get($this->config->media_url));
59 | return $data->media;
60 | }
61 |
62 | // Add object
63 | public function addObject($params) {
64 | $data = $this->curl->post($this->config->add_object_url, $params);
65 | return $data;
66 | }
67 |
68 | //Upload Media
69 | public function uploadMedia($path){
70 |
71 | }
72 |
73 | // Edit object
74 | public function editObject($params) {
75 | $data = $this->curl->put($this->config->edit_object_url, $params);
76 | return $data;
77 | }
78 |
79 | // Delete object
80 | public function deleteObject($params) {
81 | $data = $this->curl->delete($this->config->delete_object_url, $params);
82 | return $data;
83 | }
84 |
85 |
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/config/auth.php:
--------------------------------------------------------------------------------
1 | [
17 | 'guard' => 'web',
18 | 'passwords' => 'users',
19 | ],
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | Authentication Guards
24 | |--------------------------------------------------------------------------
25 | |
26 | | Next, you may define every authentication guard for your application.
27 | | Of course, a great default configuration has been defined for you
28 | | here which uses session storage and the Eloquent user provider.
29 | |
30 | | All authentication drivers have a user provider. This defines how the
31 | | users are actually retrieved out of your database or other storage
32 | | mechanisms used by this application to persist your user's data.
33 | |
34 | | Supported: "session", "token"
35 | |
36 | */
37 |
38 | 'guards' => [
39 | 'web' => [
40 | 'driver' => 'session',
41 | 'provider' => 'users',
42 | ],
43 |
44 | 'api' => [
45 | 'driver' => 'token',
46 | 'provider' => 'users',
47 | ],
48 | ],
49 |
50 | /*
51 | |--------------------------------------------------------------------------
52 | | User Providers
53 | |--------------------------------------------------------------------------
54 | |
55 | | All authentication drivers have a user provider. This defines how the
56 | | users are actually retrieved out of your database or other storage
57 | | mechanisms used by this application to persist your user's data.
58 | |
59 | | If you have multiple user tables or models you may configure multiple
60 | | sources which represent each model / table. These sources may then
61 | | be assigned to any extra authentication guards you have defined.
62 | |
63 | | Supported: "database", "eloquent"
64 | |
65 | */
66 |
67 | 'providers' => [
68 | 'users' => [
69 | 'driver' => 'eloquent',
70 | 'model' => App\User::class,
71 | ],
72 |
73 | // 'users' => [
74 | // 'driver' => 'database',
75 | // 'table' => 'users',
76 | // ],
77 | ],
78 |
79 | /*
80 | |--------------------------------------------------------------------------
81 | | Resetting Passwords
82 | |--------------------------------------------------------------------------
83 | |
84 | | You may specify multiple password reset configurations if you have more
85 | | than one user table or model in the application and you want to have
86 | | separate password reset settings based on the specific user types.
87 | |
88 | | The expire time is the number of minutes that the reset token should be
89 | | considered valid. This security feature keeps tokens short-lived so
90 | | they have less time to be guessed. You may change this as needed.
91 | |
92 | */
93 |
94 | 'passwords' => [
95 | 'users' => [
96 | 'provider' => 'users',
97 | 'table' => 'password_resets',
98 | 'expire' => 60,
99 | ],
100 | ],
101 |
102 | ];
103 |
--------------------------------------------------------------------------------
/config/database.php:
--------------------------------------------------------------------------------
1 | env('DB_CONNECTION', 'mysql'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Database Connections
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here are each of the database connections setup for your application.
24 | | Of course, examples of configuring each database platform that is
25 | | supported by Laravel is shown below to make development simple.
26 | |
27 | |
28 | | All database work in Laravel is done through the PHP PDO facilities
29 | | so make sure you have the driver for your particular database of
30 | | choice installed on your machine before you begin development.
31 | |
32 | */
33 |
34 | 'connections' => [
35 |
36 | 'sqlite' => [
37 | 'driver' => 'sqlite',
38 | 'database' => env('DB_DATABASE', database_path('database.sqlite')),
39 | 'prefix' => '',
40 | ],
41 |
42 | 'mysql' => [
43 | 'driver' => 'mysql',
44 | 'host' => env('DB_HOST', '127.0.0.1'),
45 | 'port' => env('DB_PORT', '3306'),
46 | 'database' => env('DB_DATABASE', 'forge'),
47 | 'username' => env('DB_USERNAME', 'forge'),
48 | 'password' => env('DB_PASSWORD', ''),
49 | 'unix_socket' => env('DB_SOCKET', ''),
50 | 'charset' => 'utf8mb4',
51 | 'collation' => 'utf8mb4_unicode_ci',
52 | 'prefix' => '',
53 | 'strict' => true,
54 | 'engine' => null,
55 | ],
56 |
57 | 'pgsql' => [
58 | 'driver' => 'pgsql',
59 | 'host' => env('DB_HOST', '127.0.0.1'),
60 | 'port' => env('DB_PORT', '5432'),
61 | 'database' => env('DB_DATABASE', 'forge'),
62 | 'username' => env('DB_USERNAME', 'forge'),
63 | 'password' => env('DB_PASSWORD', ''),
64 | 'charset' => 'utf8',
65 | 'prefix' => '',
66 | 'schema' => 'public',
67 | 'sslmode' => 'prefer',
68 | ],
69 |
70 | ],
71 |
72 | /*
73 | |--------------------------------------------------------------------------
74 | | Migration Repository Table
75 | |--------------------------------------------------------------------------
76 | |
77 | | This table keeps track of all the migrations that have already run for
78 | | your application. Using this information, we can determine which of
79 | | the migrations on disk haven't actually been run in the database.
80 | |
81 | */
82 |
83 | 'migrations' => 'migrations',
84 |
85 | /*
86 | |--------------------------------------------------------------------------
87 | | Redis Databases
88 | |--------------------------------------------------------------------------
89 | |
90 | | Redis is an open source, fast, and advanced key-value store that also
91 | | provides a richer set of commands than a typical key-value systems
92 | | such as APC or Memcached. Laravel makes it easy to dig right in.
93 | |
94 | */
95 |
96 | 'redis' => [
97 |
98 | 'client' => 'predis',
99 |
100 | 'default' => [
101 | 'host' => env('REDIS_HOST', '127.0.0.1'),
102 | 'password' => env('REDIS_PASSWORD', null),
103 | 'port' => env('REDIS_PORT', 6379),
104 | 'database' => 0,
105 | ],
106 |
107 | ],
108 |
109 | ];
110 |
--------------------------------------------------------------------------------
/config/mail.php:
--------------------------------------------------------------------------------
1 | env('MAIL_DRIVER', 'smtp'),
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | SMTP Host Address
24 | |--------------------------------------------------------------------------
25 | |
26 | | Here you may provide the host address of the SMTP server used by your
27 | | applications. A default option is provided that is compatible with
28 | | the Mailgun mail service which will provide reliable deliveries.
29 | |
30 | */
31 |
32 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
33 |
34 | /*
35 | |--------------------------------------------------------------------------
36 | | SMTP Host Port
37 | |--------------------------------------------------------------------------
38 | |
39 | | This is the SMTP port used by your application to deliver e-mails to
40 | | users of the application. Like the host we have set this value to
41 | | stay compatible with the Mailgun e-mail application by default.
42 | |
43 | */
44 |
45 | 'port' => env('MAIL_PORT', 587),
46 |
47 | /*
48 | |--------------------------------------------------------------------------
49 | | Global "From" Address
50 | |--------------------------------------------------------------------------
51 | |
52 | | You may wish for all e-mails sent by your application to be sent from
53 | | the same address. Here, you may specify a name and address that is
54 | | used globally for all e-mails that are sent by your application.
55 | |
56 | */
57 |
58 | 'from' => [
59 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
60 | 'name' => env('MAIL_FROM_NAME', 'Example'),
61 | ],
62 |
63 | /*
64 | |--------------------------------------------------------------------------
65 | | E-Mail Encryption Protocol
66 | |--------------------------------------------------------------------------
67 | |
68 | | Here you may specify the encryption protocol that should be used when
69 | | the application send e-mail messages. A sensible default using the
70 | | transport layer security protocol should provide great security.
71 | |
72 | */
73 |
74 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
75 |
76 | /*
77 | |--------------------------------------------------------------------------
78 | | SMTP Server Username
79 | |--------------------------------------------------------------------------
80 | |
81 | | If your SMTP server requires a username for authentication, you should
82 | | set it here. This will get used to authenticate with your server on
83 | | connection. You may also set the "password" value below this one.
84 | |
85 | */
86 |
87 | 'username' => env('MAIL_USERNAME'),
88 |
89 | 'password' => env('MAIL_PASSWORD'),
90 |
91 | /*
92 | |--------------------------------------------------------------------------
93 | | Sendmail System Path
94 | |--------------------------------------------------------------------------
95 | |
96 | | When using the "sendmail" driver to send e-mails, we will need to know
97 | | the path to where Sendmail lives on this server. A default path has
98 | | been provided here, which will work well on most of your systems.
99 | |
100 | */
101 |
102 | 'sendmail' => '/usr/sbin/sendmail -bs',
103 |
104 | /*
105 | |--------------------------------------------------------------------------
106 | | Markdown Mail Settings
107 | |--------------------------------------------------------------------------
108 | |
109 | | If you are using Markdown based email rendering, you may configure your
110 | | theme and component paths here, allowing you to customize the design
111 | | of the emails. Or, you may simply stick with the Laravel defaults!
112 | |
113 | */
114 |
115 | 'markdown' => [
116 | 'theme' => 'default',
117 |
118 | 'paths' => [
119 | resource_path('views/vendor/mail'),
120 | ],
121 | ],
122 |
123 | ];
124 |
--------------------------------------------------------------------------------
/resources/lang/en/validation.php:
--------------------------------------------------------------------------------
1 | 'The :attribute must be accepted.',
17 | 'active_url' => 'The :attribute is not a valid URL.',
18 | 'after' => 'The :attribute must be a date after :date.',
19 | 'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
20 | 'alpha' => 'The :attribute may only contain letters.',
21 | 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
22 | 'alpha_num' => 'The :attribute may only contain letters and numbers.',
23 | 'array' => 'The :attribute must be an array.',
24 | 'before' => 'The :attribute must be a date before :date.',
25 | 'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
26 | 'between' => [
27 | 'numeric' => 'The :attribute must be between :min and :max.',
28 | 'file' => 'The :attribute must be between :min and :max kilobytes.',
29 | 'string' => 'The :attribute must be between :min and :max characters.',
30 | 'array' => 'The :attribute must have between :min and :max items.',
31 | ],
32 | 'boolean' => 'The :attribute field must be true or false.',
33 | 'confirmed' => 'The :attribute confirmation does not match.',
34 | 'date' => 'The :attribute is not a valid date.',
35 | 'date_format' => 'The :attribute does not match the format :format.',
36 | 'different' => 'The :attribute and :other must be different.',
37 | 'digits' => 'The :attribute must be :digits digits.',
38 | 'digits_between' => 'The :attribute must be between :min and :max digits.',
39 | 'dimensions' => 'The :attribute has invalid image dimensions.',
40 | 'distinct' => 'The :attribute field has a duplicate value.',
41 | 'email' => 'The :attribute must be a valid email address.',
42 | 'exists' => 'The selected :attribute is invalid.',
43 | 'file' => 'The :attribute must be a file.',
44 | 'filled' => 'The :attribute field must have a value.',
45 | 'image' => 'The :attribute must be an image.',
46 | 'in' => 'The selected :attribute is invalid.',
47 | 'in_array' => 'The :attribute field does not exist in :other.',
48 | 'integer' => 'The :attribute must be an integer.',
49 | 'ip' => 'The :attribute must be a valid IP address.',
50 | 'json' => 'The :attribute must be a valid JSON string.',
51 | 'max' => [
52 | 'numeric' => 'The :attribute may not be greater than :max.',
53 | 'file' => 'The :attribute may not be greater than :max kilobytes.',
54 | 'string' => 'The :attribute may not be greater than :max characters.',
55 | 'array' => 'The :attribute may not have more than :max items.',
56 | ],
57 | 'mimes' => 'The :attribute must be a file of type: :values.',
58 | 'mimetypes' => 'The :attribute must be a file of type: :values.',
59 | 'min' => [
60 | 'numeric' => 'The :attribute must be at least :min.',
61 | 'file' => 'The :attribute must be at least :min kilobytes.',
62 | 'string' => 'The :attribute must be at least :min characters.',
63 | 'array' => 'The :attribute must have at least :min items.',
64 | ],
65 | 'not_in' => 'The selected :attribute is invalid.',
66 | 'numeric' => 'The :attribute must be a number.',
67 | 'present' => 'The :attribute field must be present.',
68 | 'regex' => 'The :attribute format is invalid.',
69 | 'required' => 'The :attribute field is required.',
70 | 'required_if' => 'The :attribute field is required when :other is :value.',
71 | 'required_unless' => 'The :attribute field is required unless :other is in :values.',
72 | 'required_with' => 'The :attribute field is required when :values is present.',
73 | 'required_with_all' => 'The :attribute field is required when :values is present.',
74 | 'required_without' => 'The :attribute field is required when :values is not present.',
75 | 'required_without_all' => 'The :attribute field is required when none of :values are present.',
76 | 'same' => 'The :attribute and :other must match.',
77 | 'size' => [
78 | 'numeric' => 'The :attribute must be :size.',
79 | 'file' => 'The :attribute must be :size kilobytes.',
80 | 'string' => 'The :attribute must be :size characters.',
81 | 'array' => 'The :attribute must contain :size items.',
82 | ],
83 | 'string' => 'The :attribute must be a string.',
84 | 'timezone' => 'The :attribute must be a valid zone.',
85 | 'unique' => 'The :attribute has already been taken.',
86 | 'uploaded' => 'The :attribute failed to upload.',
87 | 'url' => 'The :attribute format is invalid.',
88 |
89 | /*
90 | |--------------------------------------------------------------------------
91 | | Custom Validation Language Lines
92 | |--------------------------------------------------------------------------
93 | |
94 | | Here you may specify custom validation messages for attributes using the
95 | | convention "attribute.rule" to name the lines. This makes it quick to
96 | | specify a specific custom language line for a given attribute rule.
97 | |
98 | */
99 |
100 | 'custom' => [
101 | 'attribute-name' => [
102 | 'rule-name' => 'custom-message',
103 | ],
104 | ],
105 |
106 | /*
107 | |--------------------------------------------------------------------------
108 | | Custom Validation Attributes
109 | |--------------------------------------------------------------------------
110 | |
111 | | The following language lines are used to swap attribute place-holders
112 | | with something more reader friendly such as E-Mail Address instead
113 | | of "email". This simply helps us make messages a little cleaner.
114 | |
115 | */
116 |
117 | 'attributes' => [],
118 |
119 | ];
120 |
--------------------------------------------------------------------------------
/config/session.php:
--------------------------------------------------------------------------------
1 | env('SESSION_DRIVER', 'file'),
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | Session Lifetime
24 | |--------------------------------------------------------------------------
25 | |
26 | | Here you may specify the number of minutes that you wish the session
27 | | to be allowed to remain idle before it expires. If you want them
28 | | to immediately expire on the browser closing, set that option.
29 | |
30 | */
31 |
32 | 'lifetime' => 120,
33 |
34 | 'expire_on_close' => false,
35 |
36 | /*
37 | |--------------------------------------------------------------------------
38 | | Session Encryption
39 | |--------------------------------------------------------------------------
40 | |
41 | | This option allows you to easily specify that all of your session data
42 | | should be encrypted before it is stored. All encryption will be run
43 | | automatically by Laravel and you can use the Session like normal.
44 | |
45 | */
46 |
47 | 'encrypt' => false,
48 |
49 | /*
50 | |--------------------------------------------------------------------------
51 | | Session File Location
52 | |--------------------------------------------------------------------------
53 | |
54 | | When using the native session driver, we need a location where session
55 | | files may be stored. A default has been set for you but a different
56 | | location may be specified. This is only needed for file sessions.
57 | |
58 | */
59 |
60 | 'files' => storage_path('framework/sessions'),
61 |
62 | /*
63 | |--------------------------------------------------------------------------
64 | | Session Database Connection
65 | |--------------------------------------------------------------------------
66 | |
67 | | When using the "database" or "redis" session drivers, you may specify a
68 | | connection that should be used to manage these sessions. This should
69 | | correspond to a connection in your database configuration options.
70 | |
71 | */
72 |
73 | 'connection' => null,
74 |
75 | /*
76 | |--------------------------------------------------------------------------
77 | | Session Database Table
78 | |--------------------------------------------------------------------------
79 | |
80 | | When using the "database" session driver, you may specify the table we
81 | | should use to manage the sessions. Of course, a sensible default is
82 | | provided for you; however, you are free to change this as needed.
83 | |
84 | */
85 |
86 | 'table' => 'sessions',
87 |
88 | /*
89 | |--------------------------------------------------------------------------
90 | | Session Cache Store
91 | |--------------------------------------------------------------------------
92 | |
93 | | When using the "apc" or "memcached" session drivers, you may specify a
94 | | cache store that should be used for these sessions. This value must
95 | | correspond with one of the application's configured cache stores.
96 | |
97 | */
98 |
99 | 'store' => null,
100 |
101 | /*
102 | |--------------------------------------------------------------------------
103 | | Session Sweeping Lottery
104 | |--------------------------------------------------------------------------
105 | |
106 | | Some session drivers must manually sweep their storage location to get
107 | | rid of old sessions from storage. Here are the chances that it will
108 | | happen on a given request. By default, the odds are 2 out of 100.
109 | |
110 | */
111 |
112 | 'lottery' => [2, 100],
113 |
114 | /*
115 | |--------------------------------------------------------------------------
116 | | Session Cookie Name
117 | |--------------------------------------------------------------------------
118 | |
119 | | Here you may change the name of the cookie used to identify a session
120 | | instance by ID. The name specified here will get used every time a
121 | | new session cookie is created by the framework for every driver.
122 | |
123 | */
124 |
125 | 'cookie' => 'laravel_session',
126 |
127 | /*
128 | |--------------------------------------------------------------------------
129 | | Session Cookie Path
130 | |--------------------------------------------------------------------------
131 | |
132 | | The session cookie path determines the path for which the cookie will
133 | | be regarded as available. Typically, this will be the root path of
134 | | your application but you are free to change this when necessary.
135 | |
136 | */
137 |
138 | 'path' => '/',
139 |
140 | /*
141 | |--------------------------------------------------------------------------
142 | | Session Cookie Domain
143 | |--------------------------------------------------------------------------
144 | |
145 | | Here you may change the domain of the cookie used to identify a session
146 | | in your application. This will determine which domains the cookie is
147 | | available to in your application. A sensible default has been set.
148 | |
149 | */
150 |
151 | 'domain' => env('SESSION_DOMAIN', null),
152 |
153 | /*
154 | |--------------------------------------------------------------------------
155 | | HTTPS Only Cookies
156 | |--------------------------------------------------------------------------
157 | |
158 | | By setting this option to true, session cookies will only be sent back
159 | | to the server if the browser has a HTTPS connection. This will keep
160 | | the cookie from being sent to you if it can not be done securely.
161 | |
162 | */
163 |
164 | 'secure' => env('SESSION_SECURE_COOKIE', false),
165 |
166 | /*
167 | |--------------------------------------------------------------------------
168 | | HTTP Access Only
169 | |--------------------------------------------------------------------------
170 | |
171 | | Setting this value to true will prevent JavaScript from accessing the
172 | | value of the cookie and the cookie will only be accessible through
173 | | the HTTP protocol. You are free to modify this option if needed.
174 | |
175 | */
176 |
177 | 'http_only' => true,
178 |
179 | ];
180 |
--------------------------------------------------------------------------------
/app/Http/Controllers/IndexController.php:
--------------------------------------------------------------------------------
1 | bucket_slug = config('cosmic.slug');
20 | $this->read_key = config('cosmic.read');
21 | $this->write_key = config('cosmic.write');
22 | $this->locations_cosmic = new CosmicJS($this->bucket_slug, 'locations');
23 | $this->items_cosmic = new CosmicJS($this->bucket_slug, 'items', $this->read_key, $this->write_key);
24 | }
25 |
26 | public function index($location = null) {
27 |
28 | //get objects with cosmic-js php
29 | $locations = $this->locations_cosmic->getObjectsType();
30 |
31 | //set locations and bucket_slug variable to be passed to view
32 | if (property_exists($locations, 'objects')) {
33 | $data['locations'] = $locations->objects;
34 | }
35 | else
36 | {
37 | $data['locations'] = [];
38 | }
39 |
40 | $data['bucket_slug'] = $this->bucket_slug;
41 |
42 | //if location slug was passed in url, pass it to view as well
43 | if ($location) {
44 | $data['location_slug'] = $location;
45 | } else {
46 | $data['location_slug'] = '';
47 | }
48 |
49 | //load view
50 | return view('index', $data);
51 | }
52 |
53 | //fetch items for location based on slug
54 | public function itemsByLocation($slug) {
55 | //fetch items using the cosmicjs library's custom function
56 | $items = $this->items_cosmic->getByObjectSlug('location', $slug);
57 |
58 | //if the returned value has "object" property, pass it
59 | if (property_exists($items, 'objects')) {
60 | //returning arrays in laravel automatically converts it to json string
61 | return $items->objects;
62 | } else {
63 | return 0;
64 | }
65 | }
66 |
67 | public function newLocation(Request $request) {
68 | //get passed input
69 | $title = $request->input('title');
70 | $address = $request->input('address');
71 | $picture = $request->input('image');
72 |
73 | //set data array
74 | $data['title'] = $title;
75 | $data['type_slug'] = "locations";
76 | $data['bucket_slug'] = $this->bucket_slug;
77 | $metafields = array();
78 | $address_data['key'] = "address";
79 | $address_data['type'] = 'textarea';
80 | $address_data['value'] = $address;
81 | if ($picture != '') {
82 | $picture_data['key'] = "picture";
83 | $picture_data['type'] = 'file';
84 | $picture_data['value'] = $picture;
85 | array_push($metafields, $picture_data);
86 | }
87 | array_push($metafields, $address_data);
88 | $data['metafields'] = $metafields;
89 |
90 | //create a new guzzle client
91 | $client = new Client();
92 | //create guzzle request with data array passed as json value
93 | $result = $client->post('https://api.cosmicjs.com/v1/' . $this->bucket_slug . '/add-object', [
94 | 'json' => $data,
95 | 'headers' => [
96 | 'Content-type' => 'application/json',
97 | ]
98 | ]);
99 | //flash message
100 | $request->session()->flash('status', 'The location"' . $title . '" was successfully created');
101 | //return result body
102 | return $result->getBody();
103 | }
104 |
105 | //create a new item
106 | public function newItem(Request $request) {
107 | //get data
108 | $name = $request->input('name');
109 | $count = $request->input('count');
110 | $location_id = $request->input('location');
111 | $picture = $request->input('image');
112 |
113 | //create data array to be passed
114 | $data['title'] = $name;
115 | $data['type_slug'] = "items";
116 | $data['bucket_slug'] = $this->bucket_slug;
117 | $count_metafield['key'] = "count";
118 | $count_metafield['value'] = $count;
119 | $count_metafield['type'] = "text";
120 | $location_meta['key'] = "location";
121 | $location_meta['object_type'] = "locations";
122 | $location_meta['type'] = "object";
123 | $location_meta['value'] = $location_id;
124 | $metafields = array();
125 |
126 | //set picture if passed into request
127 | if ($picture != '') {
128 | $picture_data['key'] = "picture";
129 | $picture_data['type'] = 'file';
130 | $picture_data['value'] = $picture;
131 | array_push($metafields, $picture_data);
132 | }
133 | array_push($metafields, $count_metafield);
134 | array_push($metafields, $location_meta);
135 | $data['metafields'] = $metafields;
136 |
137 | $client = new Client();
138 | $result = $client->post('https://api.cosmicjs.com/v1/' . $this->bucket_slug . '/add-object', [
139 | 'json' => $data,
140 | 'headers' => [
141 | 'Content-type' => 'application/json',
142 | ]
143 | ]);
144 | //flash message
145 | $request->session()->flash('status', 'The Item "' . $name . '" was successfully created');
146 | //return result body
147 | return $result->getBody();
148 | }
149 |
150 | public function editItem(Request $request) {
151 | $name = $request->input('name');
152 | $count = $request->input('count');
153 | $slug = $request->input('slug');
154 | $location_id = $request->input('location_id');
155 |
156 | $data['title'] = $name;
157 | $data['slug'] = $slug;
158 | $count_meta['key'] = "count";
159 | $count_meta['value'] = $count;
160 | $count_meta['type'] = "text";
161 | $location_meta['key'] = "location";
162 | $location_meta['object_type'] = "locations";
163 | $location_meta['type'] = "object";
164 | $location_meta['value'] = $location_id;
165 | $metafields = array();
166 | //set picture if passed into request
167 | if ($request->input('image')) {
168 | $picture_data['key'] = "picture";
169 | $picture_data['type'] = 'file';
170 | $picture_data['value'] = $request->input('image');
171 | array_push($metafields, $picture_data);
172 | }
173 | array_push($metafields, $count_meta);
174 | array_push($metafields, $location_meta);
175 | $data['metafields'] = $metafields;
176 |
177 | $client = new Client();
178 | $result = $client->put('https://api.cosmicjs.com/v1/' . $this->bucket_slug . '/edit-object', [
179 | 'json' => $data,
180 | 'headers' => [
181 | 'Content-type' => 'application/json',
182 | ]
183 | ]);
184 | //flash message
185 | $request->session()->flash('status', 'The Item was successfully edited!');
186 | //return result body
187 | return $result->getBody();
188 | }
189 |
190 | public function deleteItem(Request $request, $slug) {
191 | //create new client and delete item
192 | $client = new Client();
193 | $result = $client->delete('https://api.cosmicjs.com/v1/' . $this->bucket_slug . '/' . $slug, [
194 | 'headers' => [
195 | 'Content-type' => 'application/json',
196 | ]
197 | ]);
198 |
199 | //flash message
200 | $request->session()->flash('status', 'The Item was successfully deleted!');
201 | return $result;
202 | }
203 |
204 | }
205 |
--------------------------------------------------------------------------------
/config/app.php:
--------------------------------------------------------------------------------
1 | env('APP_NAME', 'Laravel'),
16 |
17 | /*
18 | |--------------------------------------------------------------------------
19 | | Application Environment
20 | |--------------------------------------------------------------------------
21 | |
22 | | This value determines the "environment" your application is currently
23 | | running in. This may determine how you prefer to configure various
24 | | services your application utilizes. Set this in your ".env" file.
25 | |
26 | */
27 |
28 | 'env' => env('APP_ENV', 'production'),
29 |
30 | /*
31 | |--------------------------------------------------------------------------
32 | | Application Debug Mode
33 | |--------------------------------------------------------------------------
34 | |
35 | | When your application is in debug mode, detailed error messages with
36 | | stack traces will be shown on every error that occurs within your
37 | | application. If disabled, a simple generic error page is shown.
38 | |
39 | */
40 |
41 | 'debug' => env('APP_DEBUG', false),
42 |
43 | /*
44 | |--------------------------------------------------------------------------
45 | | Application URL
46 | |--------------------------------------------------------------------------
47 | |
48 | | This URL is used by the console to properly generate URLs when using
49 | | the Artisan command line tool. You should set this to the root of
50 | | your application so that it is used when running Artisan tasks.
51 | |
52 | */
53 |
54 | 'url' => env('APP_URL', 'http://localhost'),
55 |
56 | /*
57 | |--------------------------------------------------------------------------
58 | | Application Timezone
59 | |--------------------------------------------------------------------------
60 | |
61 | | Here you may specify the default timezone for your application, which
62 | | will be used by the PHP date and date-time functions. We have gone
63 | | ahead and set this to a sensible default for you out of the box.
64 | |
65 | */
66 |
67 | 'timezone' => 'UTC',
68 |
69 | /*
70 | |--------------------------------------------------------------------------
71 | | Application Locale Configuration
72 | |--------------------------------------------------------------------------
73 | |
74 | | The application locale determines the default locale that will be used
75 | | by the translation service provider. You are free to set this value
76 | | to any of the locales which will be supported by the application.
77 | |
78 | */
79 |
80 | 'locale' => 'en',
81 |
82 | /*
83 | |--------------------------------------------------------------------------
84 | | Application Fallback Locale
85 | |--------------------------------------------------------------------------
86 | |
87 | | The fallback locale determines the locale to use when the current one
88 | | is not available. You may change the value to correspond to any of
89 | | the language folders that are provided through your application.
90 | |
91 | */
92 |
93 | 'fallback_locale' => 'en',
94 |
95 | /*
96 | |--------------------------------------------------------------------------
97 | | Encryption Key
98 | |--------------------------------------------------------------------------
99 | |
100 | | This key is used by the Illuminate encrypter service and should be set
101 | | to a random, 32 character string, otherwise these encrypted strings
102 | | will not be safe. Please do this before deploying an application!
103 | |
104 | */
105 |
106 | 'key' => env('APP_KEY'),
107 |
108 | 'cipher' => 'AES-256-CBC',
109 |
110 | /*
111 | |--------------------------------------------------------------------------
112 | | Logging Configuration
113 | |--------------------------------------------------------------------------
114 | |
115 | | Here you may configure the log settings for your application. Out of
116 | | the box, Laravel uses the Monolog PHP logging library. This gives
117 | | you a variety of powerful log handlers / formatters to utilize.
118 | |
119 | | Available Settings: "single", "daily", "syslog", "errorlog"
120 | |
121 | */
122 |
123 | 'log' => env('APP_LOG', 'single'),
124 |
125 | 'log_level' => env('APP_LOG_LEVEL', 'debug'),
126 |
127 | /*
128 | |--------------------------------------------------------------------------
129 | | Autoloaded Service Providers
130 | |--------------------------------------------------------------------------
131 | |
132 | | The service providers listed here will be automatically loaded on the
133 | | request to your application. Feel free to add your own services to
134 | | this array to grant expanded functionality to your applications.
135 | |
136 | */
137 |
138 | 'providers' => [
139 |
140 | /*
141 | * Laravel Framework Service Providers...
142 | */
143 | Illuminate\Auth\AuthServiceProvider::class,
144 | Illuminate\Broadcasting\BroadcastServiceProvider::class,
145 | Illuminate\Bus\BusServiceProvider::class,
146 | Illuminate\Cache\CacheServiceProvider::class,
147 | Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
148 | Illuminate\Cookie\CookieServiceProvider::class,
149 | Illuminate\Database\DatabaseServiceProvider::class,
150 | Illuminate\Encryption\EncryptionServiceProvider::class,
151 | Illuminate\Filesystem\FilesystemServiceProvider::class,
152 | Illuminate\Foundation\Providers\FoundationServiceProvider::class,
153 | Illuminate\Hashing\HashServiceProvider::class,
154 | Illuminate\Mail\MailServiceProvider::class,
155 | Illuminate\Notifications\NotificationServiceProvider::class,
156 | Illuminate\Pagination\PaginationServiceProvider::class,
157 | Illuminate\Pipeline\PipelineServiceProvider::class,
158 | Illuminate\Queue\QueueServiceProvider::class,
159 | Illuminate\Redis\RedisServiceProvider::class,
160 | Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
161 | Illuminate\Session\SessionServiceProvider::class,
162 | Illuminate\Translation\TranslationServiceProvider::class,
163 | Illuminate\Validation\ValidationServiceProvider::class,
164 | Illuminate\View\ViewServiceProvider::class,
165 |
166 | /*
167 | * Package Service Providers...
168 | */
169 | Laravel\Tinker\TinkerServiceProvider::class,
170 |
171 | /*
172 | * Application Service Providers...
173 | */
174 | App\Providers\AppServiceProvider::class,
175 | App\Providers\AuthServiceProvider::class,
176 | // App\Providers\BroadcastServiceProvider::class,
177 | App\Providers\EventServiceProvider::class,
178 | App\Providers\RouteServiceProvider::class,
179 |
180 | ],
181 |
182 | /*
183 | |--------------------------------------------------------------------------
184 | | Class Aliases
185 | |--------------------------------------------------------------------------
186 | |
187 | | This array of class aliases will be registered when this application
188 | | is started. However, feel free to register as many as you wish as
189 | | the aliases are "lazy" loaded so they don't hinder performance.
190 | |
191 | */
192 |
193 | 'aliases' => [
194 |
195 | 'App' => Illuminate\Support\Facades\App::class,
196 | 'Artisan' => Illuminate\Support\Facades\Artisan::class,
197 | 'Auth' => Illuminate\Support\Facades\Auth::class,
198 | 'Blade' => Illuminate\Support\Facades\Blade::class,
199 | 'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
200 | 'Bus' => Illuminate\Support\Facades\Bus::class,
201 | 'Cache' => Illuminate\Support\Facades\Cache::class,
202 | 'Config' => Illuminate\Support\Facades\Config::class,
203 | 'Cookie' => Illuminate\Support\Facades\Cookie::class,
204 | 'Crypt' => Illuminate\Support\Facades\Crypt::class,
205 | 'DB' => Illuminate\Support\Facades\DB::class,
206 | 'Eloquent' => Illuminate\Database\Eloquent\Model::class,
207 | 'Event' => Illuminate\Support\Facades\Event::class,
208 | 'File' => Illuminate\Support\Facades\File::class,
209 | 'Gate' => Illuminate\Support\Facades\Gate::class,
210 | 'Hash' => Illuminate\Support\Facades\Hash::class,
211 | 'Lang' => Illuminate\Support\Facades\Lang::class,
212 | 'Log' => Illuminate\Support\Facades\Log::class,
213 | 'Mail' => Illuminate\Support\Facades\Mail::class,
214 | 'Notification' => Illuminate\Support\Facades\Notification::class,
215 | 'Password' => Illuminate\Support\Facades\Password::class,
216 | 'Queue' => Illuminate\Support\Facades\Queue::class,
217 | 'Redirect' => Illuminate\Support\Facades\Redirect::class,
218 | 'Redis' => Illuminate\Support\Facades\Redis::class,
219 | 'Request' => Illuminate\Support\Facades\Request::class,
220 | 'Response' => Illuminate\Support\Facades\Response::class,
221 | 'Route' => Illuminate\Support\Facades\Route::class,
222 | 'Schema' => Illuminate\Support\Facades\Schema::class,
223 | 'Session' => Illuminate\Support\Facades\Session::class,
224 | 'Storage' => Illuminate\Support\Facades\Storage::class,
225 | 'URL' => Illuminate\Support\Facades\URL::class,
226 | 'Validator' => Illuminate\Support\Facades\Validator::class,
227 | 'View' => Illuminate\Support\Facades\View::class,
228 |
229 | ],
230 |
231 | ];
232 |
--------------------------------------------------------------------------------
/resources/assets/js/components/Inventory.vue:
--------------------------------------------------------------------------------
1 |
2 |