Oops.
このコミットが含まれているのは:
コミット
b23f389218
|
@ -9,8 +9,10 @@ use Illuminate\Support\Facades\Log;
|
|||
class StoreController extends Controller {
|
||||
private $objUser;
|
||||
private $objPermission;
|
||||
private $storePath;
|
||||
|
||||
public function __construct() {
|
||||
$this->storePath = storage_path('app/public/store');
|
||||
$this->objUser = new UserController();
|
||||
$this->objPermission = new PermissionController();
|
||||
}
|
||||
|
@ -426,6 +428,7 @@ class StoreController extends Controller {
|
|||
}
|
||||
|
||||
public function countEntriesInCategory($cat_id) { // /api/rpc/store/entry/countentriesincategory/cat_id
|
||||
// return $this->storePath.'/screens';
|
||||
return DB::table('str_file')
|
||||
->where('cat_id', $cat_id)
|
||||
->where('isApproved', 1)
|
||||
|
@ -438,16 +441,76 @@ class StoreController extends Controller {
|
|||
->count();
|
||||
}
|
||||
|
||||
public function moveFile($directory, $name = null) {
|
||||
//if ($this->)
|
||||
}
|
||||
|
||||
public function uploadEntry(Request $request) { // /api/rpc/store/entry/upload
|
||||
if (!mkdir('assets/store/'.$request->id, 0755, true)) {
|
||||
$error = $error = error_get_last();
|
||||
// Log::info('Res: '.$request);exit();
|
||||
/* if (!mkdir($this->storePath.'/'.$request->id, 0755, true)) {
|
||||
Log::error('File MKDIR failed: ');
|
||||
exit();
|
||||
}
|
||||
if (!mkdir('assets/store/'.$request->id.'/screens', 0755, true)) {
|
||||
$error = $error = error_get_last();
|
||||
|
||||
if (!mkdir($this->storePath.'/'.$request->id.'/screens', 0755, true)) {
|
||||
Log::error('Asset MKDIR failed: ');
|
||||
exit();
|
||||
} */
|
||||
|
||||
foreach ($request->upfile as $f) {
|
||||
//Log::info('Name: '.gettype($f));exit();
|
||||
// $f->storeAs('store/'.$request->id, $f, 'public');exit();
|
||||
/* if ($f->storeAs('store/'.$request->id, $f, 'public')) {
|
||||
Log::error('File store failed: ');
|
||||
exit();
|
||||
} */
|
||||
}
|
||||
|
||||
$request->imgfile->storeAs('store/'.$request->id.'/screens', $m, 'public');
|
||||
exit();
|
||||
foreach ($request->imgfile as $m) {
|
||||
Log::info('Name: '.$m);
|
||||
Log::info('Name: '.gettype('store/'.$request->id.'/screens'));
|
||||
$m->storeAs('store/'.$request->id.'/screens', $m, 'public');
|
||||
// $m->store('store/'.$request->id.'/screens', 'public');
|
||||
// if ($m->storeAs('store/'.$request->id.'/screens', $m, 'public')) {
|
||||
// Log::error('Asset store failed: ');
|
||||
// exit();
|
||||
// }
|
||||
}
|
||||
exit();
|
||||
|
||||
/* foreach ($_FILES['fileupload']['tmp_name'] as $key => $files) {
|
||||
if (!empty($_FILES['fileupload']['name'][$key])) {
|
||||
$file_name = $_FILES['fileupload']['name'][$key];
|
||||
$file_tmp = $_FILES['fileupload']['tmp_name'][$key];
|
||||
|
||||
if (!move_uploaded_file($file_tmp, $this->storePath.'/'.$request->id.'/'.$file_name)) {
|
||||
$error = $error = error_get_last();
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($_FILES['imageupload']['tmp_name'] as $key => $screens) {
|
||||
if (!empty($_FILES['imageupload']['name'][$key])) {
|
||||
$file_name = $_FILES['imageupload']['name'][$key];
|
||||
$file_tmp = $_FILES['imageupload']['tmp_name'][$key];
|
||||
|
||||
if (!move_uploaded_file($file_tmp, $this->storePath.'/'.$request->id.'/screens/'.$file_name)) {
|
||||
$error = $error = error_get_last();
|
||||
exit();
|
||||
}
|
||||
|
||||
$kage = $key+1;
|
||||
|
||||
if (!rename($this->storePath.'/'.$request->id.'/screens/'.$file_name, $this->storePath.'/'.$request->id.'/screens/'.$kage.'.png')) {
|
||||
$error = $error = error_get_last();
|
||||
exit();
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
$add = DB::table('str_file')
|
||||
->insert([
|
||||
'game_id' => intval($request->game_id),
|
||||
|
|
新しいイシューから参照