本文整理汇总了PHP中app\Image::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Image::all方法的具体用法?PHP Image::all怎么用?PHP Image::all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Image
的用法示例。
在下文中一共展示了Image::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: aboutUs
/**
* Fungsi buat tampilan about us
*/
public function aboutUs()
{
$about = About::first();
$gallery = Image::all();
$tipe = Type::all();
return view('FrontEnd.aboutUs', compact('about', 'gallery', 'tipe'));
}
示例2: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($type, $id)
{
if ($id == 'video') {
$events = Video::all();
return view('video.show', compact('events'));
} elseif ($id == 'staff') {
$events = Staff::all();
return view('staff.show', compact('events'));
} elseif ($id == 'gallery') {
$events = Image::all();
return view('gallery.show', compact('events'));
} else {
$event = Event::where('slug', $id)->where('type', $type)->first();
$location = Location::where('event_id', $event->id)->first();
$slider = EventImage::where('event_id', $event->id)->orderBy(\DB::raw('RAND()'))->take(4)->get();
$gallery = EventImage::where('event_id', $event->id)->first();
if ($event->type == $type) {
if ($event->status == 1) {
return view($type . '.show', compact('event', 'location', 'slider', 'gallery'));
} else {
return redirect('/' . $type . '/');
}
}
}
}
示例3: index
public function index()
{
$images = [];
foreach (Image::all() as $image) {
$images[] = $image->serialize();
}
return response()->json(['images' => $images]);
}
示例4: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$images = Image::all();
$images->each(function ($images) {
$images->article;
});
return view('admin.images.index')->with('images', $images);
}
示例5: management
public function management()
{
if (User::is_admin()) {
$images = Image::all();
return view('image.management', compact('images'));
} else {
return redirect('/')->with('message', 'you must login to open this page');
}
}
示例6: backend
/**
* Display Backend Area.
*/
public function backend()
{
$users = User::where('id', '<>', 1)->get();
$categories = Category::all();
$projects = Project::all();
$images = Image::all();
$links = Link::all();
return view('pages/backend/index')->with('users', $users)->with('categories', $categories)->with('projects', $projects)->with('links', $links)->with('images', $images);
}
示例7: index
public function index()
{
$images = Image::all();
/**
* Por se varias imágenes se hace un recorrido
*/
$images->each(function ($images) {
$images->article;
});
return view('admin.images.index', compact('images'));
}
示例8: foreach
function getExample4()
{
$images = \App\Image::all();
echo $images;
//dump($images);
foreach ($images as $image) {
echo $image['narrative'] . '<br>';
}
foreach ($images as $image) {
echo $image->narrative . '<br>';
}
}
示例9: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
if ($this->option('all')) {
foreach (Image::all() as $image) {
$image->regenerate();
}
} elseif ($this->argument('image')) {
$image = Image::find($this->argument('image'));
if (count($image)) {
$image->regenerate();
}
}
}
示例10: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
//
$produtos = Produto::paginate(10);
//$categorias = Categoria::paginate(10);
$images = Image::all();
$categorias = Categoria::all();
//own query
$produtos_imgs = DB::table('produtos')->join('images', 'produtos.id', '=', 'images.produto_id')->select('produtos.*', 'images.file')->groupBy('produtos.nome')->get();
if (Auth::check()) {
return view('produto.list-adm-produto', compact('produtos', 'categorias'));
} else {
return view('produto.list-produto', compact('produtos', 'categorias', 'images', 'produtos_imgs'));
}
}
示例11: composeTotal
private function composeTotal()
{
view()->composer('partials.admin_sidebar', function ($view) {
$view->with('totalusers', User::all()->count());
//total admin
$view->with('totalparticipants', Participant::all()->count());
//total participant
$view->with('totalevents', Event::all()->count());
//total event
$view->with('totalposts', Post::all()->count());
//total post
$view->with('totaltags', Tag::all()->count());
//total tag
$view->with('totalimages', Image::all()->count());
//total image
});
}
示例12: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('images')->delete();
$file = storage_path('app') . '/files/images.csv';
$images = FileParse::parse_csv($file);
DB::table('images')->insert($images);
$users = \App\User::all();
$db_images = \App\Image::all();
foreach ($db_images as $key => $img) {
// $date = \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', '2015-11-'.mt_rand(1, 5).' '.mt_rand(0, 24).':00:00');
$user = $users[$key + 1];
$img->ip = $user->ip;
$img->user_id = $user->id;
$img->created_at = $user->created_at;
$img->updated_at = $user->updated_at;
$img->save();
}
}
示例13: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
//
if (Input::has("search")) {
$target = "%" . trim(Input::get()["search"], "\"") . "%";
$images = Image::where('name', 'LIKE', $target)->get();
} else {
$images = Image::all();
}
if (Input::has("sort")) {
if (Input::get()["sort"] == 1) {
$images = $images->sortBy(function ($img) {
return -sizeof($img->comments);
});
}
}
return view("homepage", ['images' => $images]);
}
示例14: index
/**
* Display a listing of the resource.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
// Validate data
$this->validate($request, ['my' => 'boolean', 'user' => 'integer|exists:user,id', 'parent_type' => 'string', 'parent_id' => 'integer']);
if ($request->has('my')) {
$images = Image::where('user_id', $request->user()->id)->get();
} elseif ($request->has('user')) {
$images = Image::where('user_id', $request->input('user'))->get();
} elseif ($request->has('parent_type') && $request->has('parent_id')) {
$images = Image::where([['parent_type', $request->input('parent_type')], ['parent_id', $request->input('parent_id')]])->get();
} else {
$images = Image::all();
}
if ($request->wantsJSON()) {
return response()->json($images->toArray(), 200);
} else {
return view('pages.image.index', ['images' => $images]);
}
}
示例15: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$cities = [];
$cities[] = City::where('geoname_id', 658225)->first();
$cities[] = City::where('geoname_id', 649360)->first();
$cities[] = City::where('geoname_id', 660158)->first();
$cities[] = City::where('geoname_id', 632453)->first();
$cities[] = City::where('geoname_id', 634963)->first();
$images = Image::all();
$users = User::all();
for ($i = 0; $i < 100; $i++) {
$city = $cities[rand(0, count($cities) - 1)];
$image = $images[rand(0, count($images) - 1)];
$logo_image = $images[rand(0, count($images) - 1)];
$user = $users[rand(0, count($users) - 1)];
$id = DB::table('designer')->insertGetId(['city_id' => $city->id, 'image_id' => $image->id, 'logo_id' => $logo_image->id, 'user_id' => $user->id, 'email' => 'contact@example.com', 'website' => 'http://www.example.com/', 'facebook' => 'https://www.facebook.com/', 'twitter' => 'https://twitter.com/', 'google_plus' => 'https://plus.google.com/', 'instagram' => 'https://www.instagram.com/', 'created_at' => Carbon::now()->format('Y-m-d H:i:s'), 'updated_at' => Carbon::now()->format('Y-m-d H:i:s')]);
DB::table('designer_translation')->insert(['designer_id' => $id, 'locale' => 'en', 'name' => 'Test Designer ' . $id, 'tagline' => 'Good typeface make any text easier to read', 'content' => file_get_contents('http://loripsum.net/api'), 'created_at' => Carbon::now()->format('Y-m-d H:i:s'), 'updated_at' => Carbon::now()->format('Y-m-d H:i:s')]);
}
}