@@ -173,7 +173,7 @@ function js($path)
173
173
174
174
if (!function_exists ('app_url ' )) {
175
175
/**
176
- * @function app_url
176
+ * @function app_url for get app root url
177
177
* @param $path
178
178
* @return string
179
179
*/
@@ -214,12 +214,13 @@ function errors($key)
214
214
}
215
215
}
216
216
217
- /**
218
- * @function for create or check path is exist
219
- * @param $path
220
- * @return string
221
- */
217
+
222
218
if (!function_exists ('path ' )) {
219
+ /**
220
+ * @function for create or check path is exist
221
+ * @param $path
222
+ * @return string
223
+ */
223
224
function path ($ path )
224
225
{
225
226
$ path = trim ($ path , '/ ' );
@@ -234,7 +235,7 @@ function path($path)
234
235
}
235
236
236
237
/**
237
- * @function for base_path
238
+ * @function for get Document root or base path
238
239
*
239
240
* @param string $path
240
241
*
@@ -250,14 +251,14 @@ function base_path($path = null)
250
251
}
251
252
}
252
253
253
- /**
254
- * @function for include file
255
- *
256
- * @param string $path
257
- *
258
- * @return void
259
- */
260
254
if (!function_exists ('include_file ' )) {
255
+ /**
256
+ * @function for include file
257
+ *
258
+ * @param string $path
259
+ *
260
+ * @return void
261
+ */
261
262
function include_file ($ path )
262
263
{
263
264
$ path = base_path ($ path );
@@ -267,6 +268,24 @@ function include_file($path)
267
268
throw new Exception ("File not found at {$ path }" );
268
269
}
269
270
}
271
+
272
+ if (!function_exists ('check_or_make_dir ' )) {
273
+ /**
274
+ * if directory not exist then create directory or return directory path
275
+ *
276
+ * @param string $path
277
+ *
278
+ * @return string $path
279
+ */
280
+ function check_or_make_dir ($ path )
281
+ {
282
+ $ path = base_path ($ path );
283
+ if (!is_dir ($ path )) {
284
+ mkdir ($ path , 0777 , true );
285
+ }
286
+ return $ path ;
287
+ }
288
+ }
270
289
}
271
290
272
291
0 commit comments