ReflectionException in Route.php line 280:
Class App\Http\Controllers\admin\FotoAlbumController does not exist
I've create my controller with this command:
php artisan make:controller admin\\FotoAlbumController --resource
But, it can't find my controller when i submit it with my form. here's my forms code:
<div class="modal-body">
{!! Form::open(['url' => 'admin/detailalbum', 'class' => 'form-horizontal', 'files' => true]) !!}
<input type="hidden" name="id_album" value="">
<div class="form-group">
<label for="foto" class="col-md-4 control-label">Photo</label>
<div class="col-md-6">
<input type="file" id="foto" name="foto" value="" required>
</div>
</div>
<div class="form-group">
<label for="caption" class="col-md-4 control-label">Caption</label>
<div class="col-md-6">
<textarea id="caption" name="caption" class="form-control" required></textarea>
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-default">Submit</button>
{!! Form::close() !!}
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
Here's my routes.php:
Route::resource('admin/detailalbum', 'admin\\FotoAlbumController');
And here's my controllers code:
namespace App\Http\Controllers\admin;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Session;
use Validator;
use App\DetailAlbum;
class FotoAlbumController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$requestData = $request->all();
$noo = 'admin/album/'.$request['id'];
$rules = [
'foto' => 'required|mimes: jpg, jpeg, png, gif',
'caption' => 'required',
];
$validasi = Validator::make($requestData, $rules);
if ($validasi->fails()) {
return back->withErrors($validasi)->withInput();
} else {
$extension = $request->file('foto')->getClientOriginalExtension();
$fileName = rand(11111, 99999) . '.' . $extension;
$request->file('foto')->move($uploadPath, $fileName);
$requestData['foto'] = $fileName;
DetailAlbum::create($requestData);
Session::flash('success', 'Berhasil menambahkan Foto pada album tersebut.');
return redirect($noo);
}
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
Is that something wrong with my code?
PS: i've already use composer dumpautoload
and php artisan clear-compile
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire